aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-08-10 01:21:46 +0800
committerChris Toshok <toshok@src.gnome.org>2001-08-10 01:21:46 +0800
commit30876e0d14b1ac0bb110dc8a1635eb434205f5fb (patch)
tree6b4042ba9aa3cfbb35e91bc98fc928fce0854b0c /addressbook/backend
parent44f7f1b1aeed1f1ec213fdacd1d1af5bc59be95d (diff)
downloadgsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.tar
gsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.tar.gz
gsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.tar.bz2
gsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.tar.lz
gsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.tar.xz
gsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.tar.zst
gsoc2013-evolution-30876e0d14b1ac0bb110dc8a1635eb434205f5fb.zip
[ Fixes ximian bugs #5080, #6021, #6704, #6705 ]
2001-08-09 Chris Toshok <toshok@ximian.com> [ Fixes ximian bugs #5080, #6021, #6704, #6705 ] * gui/component/addressbook.c (book_open_cb): create our own dialog that prompts for both the email address and the password. the email address is stored in the source and filled in for the user after the first time they enter one and press OK. * gui/component/addressbook-storage.c (create_ldap_folder): has a return value, not a int* parameter. (create_ldap_folder): new function, we can create ldap servers from the File->New->Folder menu item now. (register_storage): hook up the "create_folder" signal. (addressbook_storage_init_source_uri): remove the file case, we only build ldap uris here. (load_source_data): remove the file source stuff, and handle "emailaddr". (save_source_data): call ldap_source_foreach directly. (addressbook_source_free): remove file source stuff. (addressbook_source_copy): same. * gui/component/addressbook-storage.h: get rid of all the file source stuff from AddressbookSource, since this is only being used for ldap servers. * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_authenticate_user): look up the ldap entry based on the provided email address and use the resulting DN/passwd to authenticate. * gui/component/addressbook-config.c: pretty much gutted to make it work with the new UI. * gui/component/addressbook-config.glade: new version from anna. svn path=/trunk/; revision=11834
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 43cbe50c3a..804012d983 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -2056,18 +2056,45 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
PASRequest *req)
{
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- int ldap_error = ldap_simple_bind_s(bl->priv->ldap,
- req->user,
- req->passwd);
+ int ldap_error;
+ char *query;
+ LDAPMessage *res, *e;
+
+ query = g_strdup_printf ("(mail=%s)", req->user);
+
+ if (ldap_search_s (bl->priv->ldap,
+ bl->priv->ldap_rootdn,
+ bl->priv->ldap_scope,
+ query,
+ NULL, 0, &res) != -1) {
+ char *dn;
+
+ e = ldap_first_entry (bl->priv->ldap, res);
+ dn = ldap_get_dn (bl->priv->ldap, e);
+
+ printf ("authenticating as %s\n", dn);
+
+ ldap_error = ldap_simple_bind_s(bl->priv->ldap,
+ dn,
+ req->passwd);
- pas_book_respond_authenticate_user (book,
- ldap_error_to_response (ldap_error));
+ pas_book_respond_authenticate_user (book,
+ ldap_error_to_response (ldap_error));
+
+ bl->priv->writable = (ldap_error == LDAP_SUCCESS);
+
+ if (!bl->priv->evolutionPersonChecked)
+ check_schema_support (bl);
+
+ ldap_msgfree (res);
+ }
+ else {
+ pas_book_respond_authenticate_user (book, GNOME_Evolution_Addressbook_BookListener_PermissionDenied);
+ }
- bl->priv->writable = (ldap_error == LDAP_SUCCESS);
pas_book_report_writable (book, bl->priv->writable);
- if (!bl->priv->evolutionPersonChecked)
- check_schema_support (bl);
+ g_free (query);
}
static void