From f6a09fb8f81048891da589337d5bdeb3fc9959c7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 7 Oct 2005 00:40:29 +0000 Subject: r10790: allow updating of existing ldb opaque values (thanks to abartlet for spotting this) (This used to be commit ef13569ca94da00cc410318e61505e70f3606674) --- source4/lib/ldb/common/ldb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 725044d3f4..d34ddb4c8a 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -350,7 +350,17 @@ const char *ldb_errstring(struct ldb_context *ldb) */ 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; -- cgit