svn commit: samba r17476 - in branches/SOC/mkhl/ldb-map/modules: .

abartlet at samba.org abartlet at samba.org
Thu Aug 10 10:31:27 GMT 2006


Author: abartlet
Date: 2006-08-10 10:31:27 +0000 (Thu, 10 Aug 2006)
New Revision: 17476

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17476

Log:
Don't duplicate extensibleObject if the caller added it.

Andrew Bartlett

Modified:
   branches/SOC/mkhl/ldb-map/modules/ldb_map.c


Changeset:
Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.c
===================================================================
--- branches/SOC/mkhl/ldb-map/modules/ldb_map.c	2006-08-10 10:03:42 UTC (rev 17475)
+++ branches/SOC/mkhl/ldb-map/modules/ldb_map.c	2006-08-10 10:31:27 UTC (rev 17476)
@@ -1905,6 +1905,7 @@
 {
 	struct ldb_message_element *el, *oc;
 	struct ldb_val val;
+	BOOL found_extensibleObject = False;
 	int i;
 
 	/* Find old local objectClass */
@@ -1935,14 +1936,21 @@
 	/* Convert all local objectClasses */
 	for (i = 0; i < el->num_values - 1; i++) {
 		el->values[i] = map_objectclass_convert_local(module, el->values, &oc->values[i]);
+		if (ldb_attr_cmp((char *)el->values[i].data, "extensibleObject")) {
+			found_extensibleObject = True;
+		}
 	}
 
-	val.data = (uint8_t *)talloc_strdup(el->values, "extensibleObject");
-	val.length = strlen((char *)val.data);
+	if (!found_extensibleObject) {
+		val.data = (uint8_t *)talloc_strdup(el->values, "extensibleObject");
+		val.length = strlen((char *)val.data);
+		
+		/* Append additional objectClass "extensibleObject" */
+		el->values[i] = val;
+	} else {
+		el->num_values--;
+	}
 
-	/* Append additional objectClass "extensibleObject" */
-	el->values[i] = val;
-
 	/* Add new objectClass to remote message */
 	ldb_msg_add(remote, el, 0);
 }



More information about the samba-cvs mailing list