svn commit: samba r10790 - in branches/SAMBA_4_0/source/lib/ldb/common: .

tridge at samba.org tridge at samba.org
Fri Oct 7 00:40:30 GMT 2005


Author: tridge
Date: 2005-10-07 00:40:29 +0000 (Fri, 07 Oct 2005)
New Revision: 10790

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

Log:

allow updating of existing ldb opaque values (thanks to abartlet for
spotting this)

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2005-10-06 23:06:09 UTC (rev 10789)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2005-10-07 00:40:29 UTC (rev 10790)
@@ -350,7 +350,17 @@
 */
 int ldb_set_opaque(struct ldb_context *ldb, const char *name, void *value)
 {
-	struct ldb_opaque *o = talloc(ldb, struct ldb_opaque);
+	struct ldb_opaque *o;
+
+	/* allow updating an existing value */
+	for (o=ldb->opaque;o;o=o->next) {
+		if (strcmp(o->name, name) == 0) {
+			o->value = value;
+			return LDB_SUCCESS;
+		}
+	}
+
+	o = talloc(ldb, struct ldb_opaque);
 	if (o == NULL) {
 		ldb_oom(ldb);
 		return LDB_ERR_OTHER;



More information about the samba-cvs mailing list