summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-07 00:40:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:39:29 -0500
commitf6a09fb8f81048891da589337d5bdeb3fc9959c7 (patch)
treed0002b55611ddb61717876c0c2a04cfee0013252
parentc5069ba7e3dbabd586a3a313d6c2d287b0a46e2f (diff)
downloadsamba-f6a09fb8f81048891da589337d5bdeb3fc9959c7.tar.gz
samba-f6a09fb8f81048891da589337d5bdeb3fc9959c7.tar.bz2
samba-f6a09fb8f81048891da589337d5bdeb3fc9959c7.zip
r10790: allow updating of existing ldb opaque values (thanks to abartlet for
spotting this) (This used to be commit ef13569ca94da00cc410318e61505e70f3606674)
-rw-r--r--source4/lib/ldb/common/ldb.c12
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;