aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-08-01 04:20:06 +0800
committerChris Toshok <toshok@src.gnome.org>2002-08-01 04:20:06 +0800
commit6135f6ad4544f68ef23bdf9dca698a93cfae7067 (patch)
tree7ffa0274f7a7c367d640bacc7fe67e05ba5b065b /addressbook/backend
parent7de0e8cb10046bd29e400f1120eec6d593781156 (diff)
downloadgsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.tar
gsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.tar.gz
gsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.tar.bz2
gsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.tar.lz
gsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.tar.xz
gsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.tar.zst
gsoc2013-evolution-6135f6ad4544f68ef23bdf9dca698a93cfae7067.zip
[ roll in the following change from the 1.0 branch.] change the CALURI and
2002-07-31 Chris Toshok <toshok@ximian.com> [ roll in the following change from the 1.0 branch.] * backend/pas/pas-backend-ldap.c: (prop_info): change the CALURI and FBURL ecard attributes to map to the RFC 2739 specified attributes. (check_schema_support): check to see if calEntry is supported. (add_objectclass_mod): insert calEntry if it's supported. * backend/pas/evolutionperson.schema: deprecate freeBusyURI and calendarURI. svn path=/trunk/; revision=17657
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/pas/evolutionperson.schema2
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c66
2 files changed, 41 insertions, 27 deletions
diff --git a/addressbook/backend/pas/evolutionperson.schema b/addressbook/backend/pas/evolutionperson.schema
index f0f3a394df..4b64b3b7e4 100644
--- a/addressbook/backend/pas/evolutionperson.schema
+++ b/addressbook/backend/pas/evolutionperson.schema
@@ -167,12 +167,14 @@ attributetype ( 1.3.6.1.4.1.8506.1.2.25
SUP name
SINGLE-VALUE )
+# deprecated - use calEntry and its attributes from RFC 2739
attributetype ( 1.3.6.1.4.1.8506.1.2.26
NAME 'calendarURI'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
+# deprecated - use calEntry and its attributes from RFC 2739
attributetype ( 1.3.6.1.4.1.8506.1.2.27
NAME 'freeBusyURI'
EQUALITY caseExactIA5Match
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index e7a19c2d2c..249a652c3a 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -73,6 +73,7 @@ typedef enum {
#define PERSON "person"
#define ORGANIZATIONALPERSON "organizationalPerson"
#define INETORGPERSON "inetOrgPerson"
+#define CALENTRY "calEntry"
#define EVOLUTIONPERSON "evolutionPerson"
static gchar *query_prop_to_ldap(gchar *query_prop);
@@ -112,7 +113,8 @@ struct _PASBackendLDAPPrivate {
/* whether or not there's support for the objectclass we need
to store all our additional fields */
gboolean evolutionPersonSupported;
- gboolean schema_checked;
+ gboolean calEntrySupported;
+ gboolean evolutionPersonChecked;
gboolean writable;
@@ -261,8 +263,8 @@ struct prop_info {
E_STRING_PROP (E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "fileAs"),
E_STRING_PROP (E_CARD_SIMPLE_FIELD_CATEGORIES, "categories", "categories"),
- E_STRING_PROP (E_CARD_SIMPLE_FIELD_CALURI, "caluri", "calendarURI"),
- E_STRING_PROP (E_CARD_SIMPLE_FIELD_FBURL, "fburl", "freeBusyURI")
+ STRING_PROP (E_CARD_SIMPLE_FIELD_CALURI, "caluri", "calCalURI"),
+ STRING_PROP (E_CARD_SIMPLE_FIELD_FBURL, "fburl", "calFBURL"),
/* E_CARD_SIMPLE_FIELD_NAME_OR_ORG, */
@@ -378,7 +380,7 @@ check_schema_support (PASBackendLDAP *bl)
if (!bl->priv->schema_dn)
return;
- bl->priv->schema_checked = TRUE;
+ bl->priv->evolutionPersonChecked = TRUE;
attrs[0] = "objectClasses";
attrs[1] = NULL;
@@ -408,6 +410,11 @@ check_schema_support (PASBackendLDAP *bl)
add_oc_attributes_to_supported_fields (bl, oc);
}
+ else if (!g_strcasecmp (oc->oc_names[j], CALENTRY)) {
+ g_print ("support found on ldap server for objectclass calEntry\n");
+ bl->priv->calEntrySupported = TRUE;
+ add_oc_attributes_to_supported_fields (bl, oc);
+ }
else if (!g_strcasecmp (oc->oc_names[j], INETORGPERSON)
|| !g_strcasecmp (oc->oc_names[j], ORGANIZATIONALPERSON)
|| !g_strcasecmp (oc->oc_names[j], PERSON)) {
@@ -892,57 +899,62 @@ build_mods_from_ecards (PASBackendLDAP *bl, ECardSimple *current, ECardSimple *n
static void
add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array, GList *existing_objectclasses)
{
+#define FIND_INSERT(oc) \
+ if (!g_list_find_custom (existing_objectclasses, (oc), (GCompareFunc)g_strcasecmp)) \
+ g_ptr_array_add (objectclasses, g_strdup ((oc)))
+#define INSERT(oc) \
+ g_ptr_array_add (objectclasses, g_strdup ((oc)))
+
LDAPMod *objectclass_mod;
+ GPtrArray *objectclasses = g_ptr_array_new();
if (existing_objectclasses) {
- int i = 0;
-
objectclass_mod = g_new (LDAPMod, 1);
objectclass_mod->mod_op = LDAP_MOD_ADD;
objectclass_mod->mod_type = g_strdup ("objectClass");
- objectclass_mod->mod_values = g_new (char*, bl->priv->evolutionPersonSupported ? 6 : 5);
/* yes, this is a linear search for each of our
objectclasses, but really, how many objectclasses
are there going to be in any sane ldap entry? */
-#define FIND_INSERT(oc) \
- if (!g_list_find_custom (existing_objectclasses, (oc), (GCompareFunc)g_strcasecmp)) \
- objectclass_mod->mod_values[i++] = g_strdup ((oc));
-
FIND_INSERT (TOP);
FIND_INSERT (PERSON);
FIND_INSERT (ORGANIZATIONALPERSON);
FIND_INSERT (INETORGPERSON);
+ if (bl->priv->calEntrySupported)
+ FIND_INSERT (CALENTRY);
if (bl->priv->evolutionPersonSupported)
FIND_INSERT (EVOLUTIONPERSON);
- objectclass_mod->mod_values[i] = NULL;
- if (i) {
+ if (objectclasses->len) {
+ g_ptr_array_add (objectclasses, NULL);
+ objectclass_mod->mod_values = (char**)objectclasses->pdata;
g_ptr_array_add (mod_array, objectclass_mod);
+ g_ptr_array_free (objectclasses, FALSE);
}
else {
+ g_ptr_array_free (objectclasses, TRUE);
g_free (objectclass_mod->mod_type);
- g_free (objectclass_mod->mod_values);
g_free (objectclass_mod);
}
+
}
else {
objectclass_mod = g_new (LDAPMod, 1);
objectclass_mod->mod_op = LDAP_MOD_ADD;
objectclass_mod->mod_type = g_strdup ("objectClass");
- objectclass_mod->mod_values = g_new (char*, bl->priv->evolutionPersonSupported ? 6 : 5);
- objectclass_mod->mod_values[0] = g_strdup (TOP);
- objectclass_mod->mod_values[1] = g_strdup (PERSON);
- objectclass_mod->mod_values[2] = g_strdup (ORGANIZATIONALPERSON);
- objectclass_mod->mod_values[3] = g_strdup (INETORGPERSON);
- if (bl->priv->evolutionPersonSupported) {
- objectclass_mod->mod_values[4] = g_strdup (EVOLUTIONPERSON);
- objectclass_mod->mod_values[5] = NULL;
- }
- else {
- objectclass_mod->mod_values[4] = NULL;
- }
+
+ INSERT(TOP);
+ INSERT(PERSON);
+ INSERT(ORGANIZATIONALPERSON);
+ INSERT(INETORGPERSON);
+ if (bl->priv->calEntrySupported)
+ INSERT(CALENTRY);
+ if (bl->priv->evolutionPersonSupported)
+ INSERT(EVOLUTIONPERSON);
+ g_ptr_array_add (objectclasses, NULL);
+ objectclass_mod->mod_values = (char**)objectclasses->pdata;
g_ptr_array_add (mod_array, objectclass_mod);
+ g_ptr_array_free (objectclasses, FALSE);
}
}
@@ -2888,7 +2900,7 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
bl->priv->writable = (ldap_error == LDAP_SUCCESS);
- if (!bl->priv->schema_checked)
+ if (!bl->priv->evolutionPersonChecked)
check_schema_support (bl);
pas_book_report_writable (book, bl->priv->writable);