From 442ed02adb1d86a177b465fa656f2148a71230b1 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Mon, 25 Nov 2002 04:04:20 +0000 Subject: [ roll forward from the 1.2 branch. fixes #25540, part of #29630, as well 2002-11-23 Chris Toshok [ roll forward from the 1.2 branch. fixes #25540, part of #29630, as well as other selection issues in the contact editor and ACL issues in the ldap backend ] * backend/pas/pas-backend-ldap.c (check_schema_support): reset the schema check state to FALSE if the read returned nothing (and the user had not authenticated). we'll requery if/when they auth. (query_ldap_root_dse): free the schema dn before assigning over it. (pas_backend_ldap_connect): added a diagnostic warning about the root dse query failing in anonymous mode (if it in fact did fail.) (pas_backend_ldap_process_authenticate_user): if we successfully authed, requery the root dse to pick up any attributes that might be protected, and retry the schema query if that failed before. * gui/contact-editor/e-contact-editor.c (full_name_clicked): set the dialog's editable state based on the new field "fullname_editable", and only do the Ok button handling if this flag is TRUE. (full_addr_clicked): set the dialog's editable state based on the editable state for the particular address (from editor->address_editable[]). also, only do the Ok button handling if this flag is TRUE. (_address_arrow_pressed): use the address_editable array to determine whether the address text and the mailing address checkbutton are sensitive. (enable_writable_fields): figure out if fullname_editable is TRUE/FALSE, also, init the address_editable flags based on the field list, and handle the address checkbutton. * gui/contact-editor/fulladdr.glade: change the label names to label- to match {entry,combo}-. * gui/contact-editor/fullname.glade: same. * gui/contact-editor/e-contact-editor-fullname.c (e_contact_editor_fullname_class_init): rename ARG_IS_READ_ONLY to ARG_EDITABLE, to reflect the correct sense of the flag. (e_contact_editor_fullname_set_arg): same, and make the labels sensitive/insensitive depending on the editable state of the dialog. * gui/contact-editor/e-contact-editor-address.c (e_contact_editor_address_class_init): rename ARG_IS_READ_ONLY to ARG_EDITABLE, to reflect the correct sense of the flag. (e_contact_editor_address_set_arg): same, and make the labels sensitive/insensitive depending on the editable state of the dialog. svn path=/trunk/; revision=18910 --- addressbook/backend/pas/pas-backend-ldap.c | 36 ++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'addressbook/backend/pas/pas-backend-ldap.c') diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 3e56e02146..9a44ee6aad 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -477,6 +477,22 @@ check_schema_support (PASBackendLDAP *bl) ldap_value_free (values); } + else { + /* the reason for this is so that if the user + ends up authenticating to the ldap server, + we will requery for the subschema values. + This makes it a bit more robust in the face + of draconian acl's that keep subschema + reads from working until the user is + authed. */ + if (!bl->priv->writable) { + g_warning ("subschema read returned nothing before successful auth"); + bl->priv->evolutionPersonChecked = FALSE; + } + else { + g_warning ("subschema read returned nothing after successful auth"); + } + } ldap_msgfree (resp); } @@ -584,6 +600,7 @@ query_ldap_root_dse (PASBackendLDAP *bl) values = ldap_get_values (ldap, resp, "schemaNamingContext"); } if (values && values[0]) { + g_free (bl->priv->schema_dn); bl->priv->schema_dn = g_strdup (values[0]); } else { @@ -663,6 +680,9 @@ pas_backend_ldap_connect (PASBackendLDAP *bl) return GNOME_Evolution_Addressbook_BookListener_Success; } + else + g_warning ("Failed to perform root dse query anonymously, (ldap_error 0x%02x)", ldap_error); + } g_warning ("pas_backend_ldap_connect failed for " @@ -3130,8 +3150,20 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend, bl->priv->writable = (ldap_error == LDAP_SUCCESS); - if (!bl->priv->evolutionPersonChecked) - check_schema_support (bl); + /* if the bind was successful we force a requery on the root + dse since some ldap servers are set up such that they don't + report anything (including the schema DN) until the user is + authenticated */ + if (!bl->priv->evolutionPersonChecked && ldap_error == LDAP_SUCCESS) { + ldap_error = query_ldap_root_dse (bl); + + if (LDAP_SUCCESS == ldap_error) { + if (!bl->priv->evolutionPersonChecked) + check_schema_support (bl); + } + else + g_warning ("Failed to perform root dse query after authenticating, (ldap_error 0x%02x)", ldap_error); + } pas_book_report_writable (book, bl->priv->writable); } -- cgit v1.2.3