overload this function for modifying objectclasses too, so we can make

2001-10-29  Chris Toshok  <toshok@ximian.com>

	* backend/pas/pas-backend-ldap.c (add_objectclass_mod): overload
	this function for modifying objectclasses too, so we can make sure
	evolutionPerson shows up in the objectclasses of an entry if it
	shows up in the schema for the server.
	(create_card_handler): add @replace = FALSE in the call to
	add_objectclass_mod.
	(modify_card_handler): call add_objectclass_mod with @replace =
	TRUE.
	(anniversary_compare): fix typo - return "equal", not "TRUE".
	(birthday_compare): same.

svn path=/trunk/; revision=14402
This commit is contained in:
Chris Toshok
2001-10-30 02:32:50 +00:00
committed by Chris Toshok
parent b3e9e54480
commit 9ff66262c0
2 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,16 @@
2001-10-29 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-backend-ldap.c (add_objectclass_mod): overload
this function for modifying objectclasses too, so we can make sure
evolutionPerson shows up in the objectclasses of an entry if it
shows up in the schema for the server.
(create_card_handler): add @replace = FALSE in the call to
add_objectclass_mod.
(modify_card_handler): call add_objectclass_mod with @replace =
TRUE.
(anniversary_compare): fix typo - return "equal", not "TRUE".
(birthday_compare): same.
2001-10-29 Jon Trowbridge <trow@ximian.com>
* conduit/address-conduit.c (pre_sync): Comment out spew.

View File

@ -750,12 +750,12 @@ build_mods_from_ecards (PASBackendLDAP *bl, ECardSimple *current, ECardSimple *n
}
static void
add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array)
add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array, gboolean modify)
{
LDAPMod *objectclass_mod;
objectclass_mod = g_new (LDAPMod, 1);
objectclass_mod->mod_op = LDAP_MOD_ADD;
objectclass_mod->mod_op = modify ? LDAP_MOD_REPLACE : 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);
@ -824,7 +824,7 @@ create_card_handler (PASBackend *backend, LDAPOp *op)
g_ptr_array_remove (mod_array, NULL);
/* add our objectclass(es) */
add_objectclass_mod (bl, mod_array);
add_objectclass_mod (bl, mod_array, FALSE);
/* then put the NULL back */
g_ptr_array_add (mod_array, NULL);
@ -1088,6 +1088,17 @@ modify_card_handler (PASBackend *backend, LDAPOp *op)
/* build our mods */
mod_array = build_mods_from_ecards (bl, current_card, new_card, &need_new_dn);
if (mod_array->len > 0) {
/* remove the NULL at the end */
g_ptr_array_remove (mod_array, NULL);
/* add our objectclass(es), making sure
evolutionPerson is there if it's supported */
add_objectclass_mod (bl, mod_array, TRUE);
/* then put the NULL back */
g_ptr_array_add (mod_array, NULL);
ldap_mods = (LDAPMod**)mod_array->pdata;
/* actually perform the ldap modify */
@ -1636,7 +1647,7 @@ anniversary_compare (ECardSimple *ecard1, ECardSimple *ecard2)
g_free (date1);
g_free (date2);
return TRUE;
return equal;
}
static void
@ -1703,7 +1714,7 @@ birthday_compare (ECardSimple *ecard1, ECardSimple *ecard2)
g_free (date1);
g_free (date2);
return TRUE;
return equal;
}
#define IS_RFC2254_CHAR(c) ((c) == '*' || (c) =='\\' || (c) == '(' || (c) == ')' || (c) == '\0')