aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-01-25 12:22:58 +0800
committerChris Toshok <toshok@src.gnome.org>2002-01-25 12:22:58 +0800
commit9b1f4e133bc79b2cac6cf342972c713739b075a6 (patch)
tree07066b05749e5327182a0a6b45df3f2ca29d952a /addressbook
parent19bf10036145eb24280ac5792dd85add67d4d238 (diff)
downloadgsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar
gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.gz
gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.bz2
gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.lz
gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.xz
gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.tar.zst
gsoc2013-evolution-9b1f4e133bc79b2cac6cf342972c713739b075a6.zip
[ fixes bug 16097 ] gui love for the new auth stuff.
2002-01-24 Chris Toshok <toshok@ximian.com> [ fixes bug 16097 ] * gui/component/addressbook-config.glade: gui love for the new auth stuff. * gui/component/addressbook.c (load_uri_cb): track change to auth, and offer up different prompt strings depending on which method (binddn or email) we're using. * gui/component/addressbook-storage.c (ldap_unparse_auth): use the new auth types for ldap. (ldap_parse_auth): same. (addressbook_storage_auth_type_to_string): new function. (load_source_data): get the binddn too. (ldap_source_foreach): store out binddn or emailaddr, depending on the auth type chosen. * gui/component/addressbook-storage.h: add the more detailed auth types, add "binddn" to the source structure, and add a prototype for addressbook_storage_auth_type_to_string. * gui/component/addressbook-config.c (auth_checkbutton_changed): set the auth stuff (in)sensitive. (auth_optionmenu_activated): new function. (addressbook_source_dialog_set_source): track UI change. (addressbook_source_dialog_get_source): same. (add_scope_activate_cb): rename add_activate_cb to this to distinguish it from the auth stuff. (add_auth_activate_cb): new function. (addressbook_source_dialog): track change to auth UI stuff. (addressbook_storage_auth_type_to_string): new function. * backend/ebook/e-book.h: add auth_method arg to e_book_authenticate_user. * backend/ebook/e-book.c (e_book_authenticate_user): track change to prototype - add auth_method arg, and pass it along to the CORBA call. * backend/ebook/test-client.c (book_open_cb): track api change - keep this building. * backend/pas/pas-book.h: add auth_method slot in PASRequest. * backend/pas/pas-book.c (pas_book_queue_authenticate_user): add auth_method arg and add it to the PASRequest. (impl_GNOME_Evolution_Addressbook_Book_authenticateUser): track idl change, add auth_method and pass it along to pas_book_queue_authenticate_user. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_authenticate_user): support both "ldap/simple-email" and "ldap/simple-binddn" auth methods. * backend/idl/addressbook.idl: add "in string authMethod" to authenticateUser. svn path=/trunk/; revision=15467
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog58
-rw-r--r--addressbook/backend/ebook/e-book.c2
-rw-r--r--addressbook/backend/ebook/e-book.h1
-rw-r--r--addressbook/backend/ebook/test-client.c4
-rw-r--r--addressbook/backend/idl/addressbook.idl3
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c66
-rw-r--r--addressbook/backend/pas/pas-book.c6
-rw-r--r--addressbook/backend/pas/pas-book.h1
-rw-r--r--addressbook/gui/component/addressbook-config.c79
-rw-r--r--addressbook/gui/component/addressbook-config.glade322
-rw-r--r--addressbook/gui/component/addressbook.c20
11 files changed, 445 insertions, 117 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index d1be6e5907..da06d3d2ac 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,61 @@
+2002-01-24 Chris Toshok <toshok@ximian.com>
+
+ [ fixes bug 16097 ]
+ * gui/component/addressbook-config.glade: gui love for the new
+ auth stuff.
+
+ * gui/component/addressbook.c (load_uri_cb): track change to auth,
+ and offer up different prompt strings depending on which method
+ (binddn or email) we're using.
+
+ * gui/component/addressbook-storage.c (ldap_unparse_auth): use the
+ new auth types for ldap.
+ (ldap_parse_auth): same.
+ (addressbook_storage_auth_type_to_string): new function.
+ (load_source_data): get the binddn too.
+ (ldap_source_foreach): store out binddn or emailaddr, depending on
+ the auth type chosen.
+
+ * gui/component/addressbook-storage.h: add the more detailed auth
+ types, add "binddn" to the source structure, and add a prototype
+ for addressbook_storage_auth_type_to_string.
+
+ * gui/component/addressbook-config.c (auth_checkbutton_changed):
+ set the auth stuff (in)sensitive.
+ (auth_optionmenu_activated): new function.
+ (addressbook_source_dialog_set_source): track UI change.
+ (addressbook_source_dialog_get_source): same.
+ (add_scope_activate_cb): rename add_activate_cb to this to
+ distinguish it from the auth stuff.
+ (add_auth_activate_cb): new function.
+ (addressbook_source_dialog): track change to auth UI stuff.
+ (addressbook_storage_auth_type_to_string): new function.
+
+ * backend/ebook/e-book.h: add auth_method arg to
+ e_book_authenticate_user.
+
+ * backend/ebook/e-book.c (e_book_authenticate_user): track change
+ to prototype - add auth_method arg, and pass it along to the CORBA
+ call.
+
+ * backend/ebook/test-client.c (book_open_cb): track api change -
+ keep this building.
+
+ * backend/pas/pas-book.h: add auth_method slot in PASRequest.
+
+ * backend/pas/pas-book.c (pas_book_queue_authenticate_user): add
+ auth_method arg and add it to the PASRequest.
+ (impl_GNOME_Evolution_Addressbook_Book_authenticateUser): track
+ idl change, add auth_method and pass it along to
+ pas_book_queue_authenticate_user.
+
+ * backend/pas/pas-backend-ldap.c
+ (pas_backend_ldap_process_authenticate_user): support both
+ "ldap/simple-email" and "ldap/simple-binddn" auth methods.
+
+ * backend/idl/addressbook.idl: add "in string authMethod" to
+ authenticateUser.
+
2002-01-24 Ettore Perazzoli <ettore@ximian.com>
* conduit/Makefile.am: Use EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index d787ee8e01..fdc7252cfa 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -888,6 +888,7 @@ void
e_book_authenticate_user (EBook *book,
const char *user,
const char *passwd,
+ const char *auth_method,
EBookCallback cb,
gpointer closure)
{
@@ -908,6 +909,7 @@ e_book_authenticate_user (EBook *book,
GNOME_Evolution_Addressbook_Book_authenticateUser (book->priv->corba_book,
user,
passwd,
+ auth_method,
&ev);
if (ev._major != CORBA_NO_EXCEPTION) {
diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h
index cf90c8c57d..1403a23f60 100644
--- a/addressbook/backend/ebook/e-book.h
+++ b/addressbook/backend/ebook/e-book.h
@@ -74,6 +74,7 @@ guint e_book_get_supported_fields (EBook *book,
void e_book_authenticate_user (EBook *book,
const char *user,
const char *passwd,
+ const char *auth_method,
EBookCallback cb,
gpointer closure);
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index 44b20ebdde..900edcd024 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -128,7 +128,7 @@ auth_user_cb (EBook *book, EBookStatus status, gpointer closure)
static void
book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
- e_book_authenticate_user (book, "username", "password", auth_user_cb, NULL);
+ e_book_authenticate_user (book, "username", "password", "auth_method", auth_user_cb, NULL);
}
static guint
@@ -146,7 +146,7 @@ ebook_create (void)
}
- if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) {
+ if (! e_book_load_default_book (book, book_open_cb, NULL)) {
printf ("error calling load_uri!\n");
}
diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl
index 342482d573..21479d1de2 100644
--- a/addressbook/backend/idl/addressbook.idl
+++ b/addressbook/backend/idl/addressbook.idl
@@ -47,7 +47,8 @@ module Addressbook {
*/
void getVCard (in CardId id);
- void authenticateUser (in string user, in string passwd);
+ void authenticateUser (in string user, in string passwd,
+ in string authMethod);
/*
* Adding and deleting cards in the book.
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index ff5c29168b..cfd6b0d1d5 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -2412,46 +2412,50 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
{
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
int ldap_error;
- char *query;
- LDAPMessage *res, *e;
-
- query = g_strdup_printf ("(mail=%s)", req->user);
-
- ldap_error = ldap_search_s (bl->priv->ldap,
- bl->priv->ldap_rootdn,
- bl->priv->ldap_scope,
- query,
- NULL, 0, &res);
-
- if (ldap_error == LDAP_SUCCESS) {
- char *dn;
+ char *dn = NULL;
- e = ldap_first_entry (bl->priv->ldap, res);
- dn = ldap_get_dn (bl->priv->ldap, e);
+ if (!strcmp (req->auth_method, "ldap/simple-email")) {
+ LDAPMessage *res, *e;
+ char *query = g_strdup_printf ("(mail=%s)", req->user);
- printf ("authenticating as %s\n", dn);
+ ldap_error = ldap_search_s (bl->priv->ldap,
+ bl->priv->ldap_rootdn,
+ bl->priv->ldap_scope,
+ query,
+ NULL, 0, &res);
+ g_free (query);
- ldap_error = ldap_simple_bind_s(bl->priv->ldap,
- dn,
- req->passwd);
+ if (ldap_error == LDAP_SUCCESS) {
+ e = ldap_first_entry (bl->priv->ldap, res);
+ dn = g_strdup(ldap_get_dn (bl->priv->ldap, e));
+ ldap_msgfree (res);
+ }
+ else {
+ pas_book_respond_authenticate_user (book,
+ GNOME_Evolution_Addressbook_BookListener_PermissionDenied);
+ return;
+ }
+ }
+ else {
+ dn = g_strdup (req->user);
+ }
- pas_book_respond_authenticate_user (book,
- ldap_error_to_response (ldap_error));
+ /* now authenticate against the DN we were either supplied or queried for */
+ printf ("authenticating as %s\n", dn);
+ ldap_error = ldap_simple_bind_s(bl->priv->ldap,
+ dn,
+ req->passwd);
+ g_free (dn);
- bl->priv->writable = (ldap_error == LDAP_SUCCESS);
+ pas_book_respond_authenticate_user (book,
+ ldap_error_to_response (ldap_error));
- if (!bl->priv->evolutionPersonChecked)
- check_schema_support (bl);
+ bl->priv->writable = (ldap_error == LDAP_SUCCESS);
- ldap_msgfree (res);
- }
- else {
- pas_book_respond_authenticate_user (book, GNOME_Evolution_Addressbook_BookListener_PermissionDenied);
- }
+ if (!bl->priv->evolutionPersonChecked)
+ check_schema_support (bl);
pas_book_report_writable (book, bl->priv->writable);
-
- g_free (query);
}
static void
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index d51d182dad..b0b35b2c0f 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -129,7 +129,7 @@ pas_book_queue_get_vcard (PASBook *book, const char *id)
static void
pas_book_queue_authenticate_user (PASBook *book,
- const char *user, const char *passwd)
+ const char *user, const char *passwd, const char *auth_method)
{
PASRequest *req;
@@ -137,6 +137,7 @@ pas_book_queue_authenticate_user (PASBook *book,
req->op = AuthenticateUser;
req->user = g_strdup(user);
req->passwd = g_strdup(passwd);
+ req->auth_method = g_strdup(auth_method);
pas_book_queue_request (book, req);
}
@@ -226,11 +227,12 @@ static void
impl_GNOME_Evolution_Addressbook_Book_authenticateUser (PortableServer_Servant servant,
const char* user,
const char* passwd,
+ const char* auth_method,
CORBA_Environment *ev)
{
PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant));
- pas_book_queue_authenticate_user (book, user, passwd);
+ pas_book_queue_authenticate_user (book, user, passwd, auth_method);
}
static void
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
index 6f5832d914..8afba26b45 100644
--- a/addressbook/backend/pas/pas-book.h
+++ b/addressbook/backend/pas/pas-book.h
@@ -45,6 +45,7 @@ typedef struct {
char *change_id;
char *user;
char *passwd;
+ char *auth_method;
GNOME_Evolution_Addressbook_BookViewListener listener;
GNOME_Evolution_Addressbook_stringlist fields;
} PASRequest;
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index 33feb391ab..5061e6368b 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -29,15 +29,19 @@ struct _AddressbookSourceDialog {
GtkWidget *name;
GtkWidget *host;
+
+ GtkWidget *auth_checkbutton;
+ GtkWidget *auth_optionmenu;
+ GtkWidget *auth_notebook;
GtkWidget *email;
- GtkWidget *email_label;
+ GtkWidget *binddn;
+ int auth;
GtkWidget *port;
GtkWidget *rootdn;
GtkWidget *limit;
GtkWidget *scope_optionmenu;
AddressbookLDAPScopeType ldap_scope;
- GtkWidget *auth_checkbutton;
gint id; /* button we closed the dialog with */
@@ -83,14 +87,14 @@ auth_checkbutton_changed (GtkWidget *item, AddressbookSourceDialog *dialog)
/* make sure the change is reflected by the state of the dialog's OK button */
addressbook_source_edit_changed (item, dialog);
- gtk_widget_set_sensitive (dialog->email_label,
+ gtk_widget_set_sensitive (dialog->auth_optionmenu,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
+ gtk_widget_set_sensitive (dialog->auth_notebook,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
- gtk_entry_set_editable (GTK_ENTRY(dialog->email),
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
}
static void
-option_menuitem_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
+scope_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
{
/* make sure the change is reflected by the state of the dialog's OK button */
addressbook_source_edit_changed (item, dialog);
@@ -99,6 +103,18 @@ option_menuitem_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
item);
}
+static void
+auth_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ /* make sure the change is reflected by the state of the dialog's OK button */
+ addressbook_source_edit_changed (item, dialog);
+
+ dialog->auth = g_list_index (gtk_container_children (GTK_CONTAINER (item->parent)),
+ item) + 1;
+
+ gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_notebook), dialog->auth - 1);
+}
+
typedef struct {
GtkWidget *notebook;
int page_num;
@@ -132,18 +148,24 @@ addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, Addressbo
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->name), source ? source->name : "");
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->host), source ? source->host : "");
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->email), source ? source->email_addr : "");
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->binddn), source ? source->binddn : "");
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->port), source ? source->port : "389");
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), source ? source->rootdn : "");
+
string = g_strdup_printf ("%d", source ? source->limit : 100);
e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->limit), string);
g_free (string);
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL);
+ dialog->auth = source ? source->auth : ADDRESSBOOK_LDAP_AUTH_NONE;
+ if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE)
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth - 1);
+
dialog->ldap_scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->ldap_scope);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE);
- gtk_widget_set_sensitive (dialog->email_label, source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE);
- gtk_entry_set_editable (GTK_ENTRY(dialog->email), source && source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+ gtk_widget_set_sensitive (dialog->auth_optionmenu, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+ gtk_widget_set_sensitive (dialog->auth_notebook, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
}
static AddressbookSource *
@@ -154,12 +176,12 @@ addressbook_source_dialog_get_source (AddressbookSourceDialog *dialog)
source->name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->name));
source->host = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->host));
source->email_addr = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->email));
+ source->binddn = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->binddn));
source->port = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->port));
source->rootdn = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->rootdn));
source->limit = atoi(e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->limit)));
source->scope = dialog->ldap_scope;
- source->auth = (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->auth_checkbutton))
- ? ADDRESSBOOK_LDAP_AUTH_SIMPLE : ADDRESSBOOK_LDAP_AUTH_NONE);
+ source->auth = dialog->auth;
addressbook_storage_init_source_uri (source);
@@ -173,12 +195,20 @@ addressbook_source_dialog_ok_clicked (GtkWidget *widget, AddressbookSourceDialog
}
static void
-add_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
+add_scope_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (scope_optionmenu_activated), dialog);
+}
+
+static void
+add_auth_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
{
gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (option_menuitem_activated), dialog);
+ GTK_SIGNAL_FUNC (auth_optionmenu_activated), dialog);
}
+
static AddressbookSourceDialog*
addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *parent)
{
@@ -214,18 +244,25 @@ addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *
GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
add_focus_handler (dialog->host, dialog->basic_notebook, 1);
- dialog->email = glade_xml_get_widget (gui, "email-address-entry");
- gtk_signal_connect (GTK_OBJECT (dialog->email), "changed",
- GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
- add_focus_handler (dialog->email, dialog->basic_notebook, 2);
-
- dialog->email_label = glade_xml_get_widget (gui, "email-address-label");
+ /* BASIC -> AUTH STUFF */
+ dialog->auth_notebook = glade_xml_get_widget (gui, "auth-notebook");
dialog->auth_checkbutton = glade_xml_get_widget (gui, "auth-checkbutton");
add_focus_handler (dialog->auth_checkbutton, dialog->basic_notebook, 2);
gtk_signal_connect (GTK_OBJECT (dialog->auth_checkbutton), "toggled",
GTK_SIGNAL_FUNC (auth_checkbutton_changed), dialog);
+ dialog->auth_optionmenu = glade_xml_get_widget (gui, "auth-optionmenu");
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->auth_optionmenu));
+ gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_auth_activate_cb, dialog);
+ add_focus_handler (dialog->auth_optionmenu, dialog->basic_notebook, 3);
+
+ dialog->email = glade_xml_get_widget (gui, "email-entry");
+ add_focus_handler (dialog->email, dialog->basic_notebook, 4);
+
+ dialog->binddn = glade_xml_get_widget (gui, "dn-entry");
+ add_focus_handler (dialog->binddn, dialog->basic_notebook, 5);
+
/* ADVANCED STUFF */
dialog->port = glade_xml_get_widget (gui, "port-entry");
gtk_signal_connect (GTK_OBJECT (dialog->port), "changed",
@@ -240,7 +277,7 @@ addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *
dialog->scope_optionmenu = glade_xml_get_widget (gui, "scope-optionmenu");
add_focus_handler (dialog->scope_optionmenu, dialog->advanced_notebook, 2);
menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->scope_optionmenu));
- gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_activate_cb, dialog);
+ gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_scope_activate_cb, dialog);
dialog->limit = glade_xml_get_widget (gui, "limit-entry");
gtk_signal_connect (GTK_OBJECT (dialog->limit), "changed",
diff --git a/addressbook/gui/component/addressbook-config.glade b/addressbook/gui/component/addressbook-config.glade
index 50b36e2462..23ef8105a5 100644
--- a/addressbook/gui/component/addressbook-config.glade
+++ b/addressbook/gui/component/addressbook-config.glade
@@ -2,6 +2,8 @@
<GTK-Interface>
<project>
+ <name>addressbook-config-mockup</name>
+ <program_name>addressbook-config-mockup</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
@@ -94,7 +96,7 @@
<name>vbox1</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
- <spacing>6</spacing>
+ <spacing>3</spacing>
<widget>
<class>GtkLabel</class>
@@ -117,7 +119,7 @@
<class>GtkTable</class>
<name>table1</name>
<border_width>3</border_width>
- <rows>3</rows>
+ <rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>3</row_spacing>
@@ -229,36 +231,15 @@
<yfill>False</yfill>
</child>
</widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>auth-checkbutton</name>
- <can_focus>True</can_focus>
- <label>_My server requires authentication</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
</widget>
<widget>
- <class>GtkHBox</class>
- <name>hbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
+ <class>GtkAlignment</class>
+ <name>alignment2</name>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -266,35 +247,187 @@
</child>
<widget>
- <class>GtkLabel</class>
- <name>email-address-label</name>
- <label>Email Address:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
+ <class>GtkVBox</class>
+ <name>auth-vbox</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
- <widget>
- <class>GtkEntry</class>
- <name>email-address-entry</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox9</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>auth-checkbutton</name>
+ <can_focus>True</can_focus>
+ <label>A_uthenticate with server using:</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox10</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>auth-optionmenu</name>
+ <can_focus>True</can_focus>
+ <items>Email address
+Distinguished name (DN)
+</items>
+ <initial_choice>0</initial_choice>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>auth-notebook</name>
+ <show_tabs>False</show_tabs>
+ <show_border>False</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox5</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>email-label</name>
+ <label>_Email address:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>email-entry</default_focus_target>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>email-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label52</name>
+ <label>label52</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox6</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>dn-label</name>
+ <label>_Distinguished Name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>dn-entry</default_focus_target>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>dn-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label53</name>
+ <label>label53</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
</widget>
</widget>
@@ -366,6 +499,56 @@
<widget>
<class>GtkLabel</class>
+ <name>label57</name>
+ <label>Check this if the server requires you to authenticate.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label56</name>
+ <label>label56</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label61</name>
+ <label>This is the method evolution will use to authenticate you. Note that setting this to &quot;Email Address&quot; requires anonymous access to your ldap server.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label60</name>
+ <label>label60</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
<name>label48</name>
<label>Evolution will use this email address to authenticate you with the server</label>
<justify>GTK_JUSTIFY_CENTER</justify>
@@ -388,6 +571,31 @@
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label59</name>
+ <label>Evolution will use this Distinquished Name (DN) to authenticate you with the server</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label58</name>
+ <label>label58</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
</widget>
</widget>
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 93c3bdf246..74aceb9c4e 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -641,7 +641,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
if (source &&
source->type == ADDRESSBOOK_SOURCE_LDAP &&
- source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
+ source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
const char *password;
char *pass_dup = NULL;
@@ -651,7 +651,12 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
char *prompt;
gboolean remember;
- prompt = g_strdup_printf (_("Enter password for %s (user %s)"), source->name, source->email_addr);
+ if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
+ prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
+ source->name, source->binddn);
+ else
+ prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
+ source->name, source->email_addr);
remember = source->remember_passwd;
pass_dup = e_passwords_ask_password (
prompt, load_uri_data->uri, prompt, TRUE,
@@ -665,7 +670,16 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
}
if (password || pass_dup) {
- e_book_authenticate_user (book, source->email_addr, password ? password : pass_dup,
+ char *user;
+
+ if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
+ user = source->binddn;
+ else
+ user = source->email_addr;
+ if (!user)
+ user = "";
+ e_book_authenticate_user (book, user, password ? password : pass_dup,
+ addressbook_storage_auth_type_to_string (source->auth),
load_uri_auth_cb, closure);
g_free (pass_dup);
return;