From 9b1f4e133bc79b2cac6cf342972c713739b075a6 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 25 Jan 2002 04:22:58 +0000 Subject: [ fixes bug 16097 ] gui love for the new auth stuff. 2002-01-24 Chris Toshok [ 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 --- addressbook/ChangeLog | 58 ++++ addressbook/backend/ebook/e-book.c | 2 + addressbook/backend/ebook/e-book.h | 1 + addressbook/backend/ebook/test-client.c | 4 +- addressbook/backend/idl/addressbook.idl | 3 +- addressbook/backend/pas/pas-backend-ldap.c | 66 +++-- addressbook/backend/pas/pas-book.c | 6 +- addressbook/backend/pas/pas-book.h | 1 + addressbook/gui/component/addressbook-config.c | 79 +++-- addressbook/gui/component/addressbook-config.glade | 322 +++++++++++++++++---- addressbook/gui/component/addressbook.c | 20 +- 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 + + [ 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 * 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 @@ + addressbook-config-mockup + addressbook-config-mockup src pixmaps @@ -94,7 +96,7 @@ vbox1 3 False - 6 + 3 GtkLabel @@ -117,7 +119,7 @@ GtkTable table1 3 - 3 + 2 2 False 3 @@ -229,36 +231,15 @@ False - - - GtkCheckButton - auth-checkbutton - True - - False - True - - 0 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - GtkHBox - hbox4 - False - 0 + GtkAlignment + alignment2 + 0 + 0.5 + 1 + 1 0 False @@ -266,35 +247,187 @@ - GtkLabel - email-address-label - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - + GtkVBox + auth-vbox + False + 3 - - GtkEntry - email-address-entry - True - True - True - 0 - - - 0 - True - True - + + GtkHBox + hbox9 + False + 0 + + 0 + False + False + + + + GtkCheckButton + auth-checkbutton + True + + False + True + + 0 + False + False + + + + + GtkHBox + hbox10 + False + 3 + + 0 + True + True + + + + GtkOptionMenu + auth-optionmenu + True + Email address +Distinguished name (DN) + + 0 + + 0 + False + False + + + + + + + GtkNotebook + auth-notebook + False + False + GTK_POS_TOP + False + 2 + 2 + False + + 0 + True + True + + + + GtkHBox + hbox5 + 3 + False + 3 + + + GtkLabel + email-label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + email-entry + + 0 + False + False + + + + + GtkEntry + email-entry + True + True + True + 0 + + + 0 + True + True + + + + + + GtkLabel + Notebook:tab + label52 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkHBox + hbox6 + False + 3 + + + GtkLabel + dn-label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + dn-entry + + 0 + False + False + + + + + GtkEntry + dn-entry + True + True + True + 0 + + + 0 + True + True + + + + + + GtkLabel + Notebook:tab + label53 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + @@ -364,6 +497,56 @@ 0 + + GtkLabel + label57 + + GTK_JUSTIFY_CENTER + True + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + Notebook:tab + label56 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + label61 + + GTK_JUSTIFY_CENTER + True + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + Notebook:tab + label60 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + GtkLabel label48 @@ -388,6 +571,31 @@ 0 0 + + + GtkLabel + label59 + + GTK_JUSTIFY_CENTER + True + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + Notebook:tab + label58 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + 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; -- cgit v1.2.3