diff options
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 12 |
1 files changed, 11 insertions, 1 deletions
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; |