aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog7
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c48
2 files changed, 53 insertions, 2 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7ed3b78260..1f904bf7ce 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,10 @@
+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.)
+
2001-02-07 Christopher James Lahey <clahey@ximian.com>
* gui/widgets/e-addressbook-view.c: Added N_("* Click here to add
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