From e66038cbaf3a26e99ec7c9b811b534471d3b0cd0 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Thu, 8 Feb 2001 01:57:09 +0000 Subject: flesh out this check. #ifdef the entire thing OPENLDAP2, as it only works 2001-02-07 Chris Toshok * 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 --- addressbook/backend/pas/pas-backend-ldap.c | 48 ++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'addressbook/backend') 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 -- cgit