diff options
author | Chris Toshok <toshok@ximian.com> | 2001-02-08 09:57:09 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-02-08 09:57:09 +0800 |
commit | e66038cbaf3a26e99ec7c9b811b534471d3b0cd0 (patch) | |
tree | d3e310166da71c7e6b71de362cc9e70c27dc51fe /addressbook/backend/pas | |
parent | 4459154549f367cb1fa8a89b06e89d8f99abb4e3 (diff) | |
download | gsoc2013-evolution-e66038cbaf3a26e99ec7c9b811b534471d3b0cd0.tar.gz gsoc2013-evolution-e66038cbaf3a26e99ec7c9b811b534471d3b0cd0.tar.zst gsoc2013-evolution-e66038cbaf3a26e99ec7c9b811b534471d3b0cd0.zip |
flesh out this check. #ifdef the entire thing OPENLDAP2, as it only works
2001-02-07 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-backend-ldap.c (check_for_evolve_person): flesh
out this check. #ifdef the entire thing OPENLDAP2, as it only
works with the new schema stuff in openldap 2.x (both on server
and client, so upgrade your server.)
svn path=/trunk/; revision=8097
Diffstat (limited to 'addressbook/backend/pas')
-rw-r--r-- | addressbook/backend/pas/pas-backend-ldap.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 417567826e..4bd9b4d2c2 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -33,6 +33,10 @@ #define LDAP_NAME_ERROR(x) NAME_ERROR(x) #endif +#ifdef OPENLDAP2 +#include "ldap_schema.h" +#endif + #include "pas-backend-ldap.h" #include "pas-book.h" #include "pas-card-cursor.h" @@ -265,9 +269,49 @@ view_destroy(GtkObject *object, gpointer data) static void check_for_evolve_person (PASBackendLDAP *bl) { - /* XXX for now, we don't have an evolve person */ +#ifdef OPENLDAP2 + char *attrs[2]; + LDAPMessage *resp; + LDAP *ldap = bl->priv->ldap; +#endif + bl->priv->evolvePersonChecked = TRUE; - bl->priv->evolvePersonSupported = FALSE; + +#ifdef OPENLDAP2 + attrs[0] = "objectClasses"; + attrs[1] = NULL; + + if (ldap_search_ext_s (ldap, "cn=Subschema", LDAP_SCOPE_BASE, + "(objectClass=subschema)", attrs, 0, + NULL, NULL, NULL, 0, &resp) == LDAP_SUCCESS) { + char **values; + + values = ldap_get_values (ldap, resp, "objectClasses"); + + if (values) { + int i; + for (i = 0; values[i]; i ++) { + int j; + int code; + const char *err; + LDAPObjectClass *oc = ldap_str2objectclass (values[i], &code, &err, 0); + if (!oc) + continue; + + for (j = 0; oc->oc_names[j]; j++) + if (!g_strcasecmp (oc->oc_names[j], EVOLVEPERSON)) { + g_print ("support found on ldap server for objectclass evolvePerson\n"); + bl->priv->evolvePersonSupported = TRUE; + ldap_objectclass_free (oc); + goto done; + } + + ldap_objectclass_free (oc); + } + done: + } + } +#endif } static void |