summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-02 07:51:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:07:55 -0500
commit500d5523d2a83234d6bfbf264d78293426488bfc (patch)
tree2a90456d248fb4c27184771ac2ede645356e6025 /source4/lib
parent1a988ec9af7960616fb4661b20d86ff05146d836 (diff)
downloadsamba-500d5523d2a83234d6bfbf264d78293426488bfc.tar.gz
samba-500d5523d2a83234d6bfbf264d78293426488bfc.tar.bz2
samba-500d5523d2a83234d6bfbf264d78293426488bfc.zip
r4475: fixed smbd to work with the small changes in the ldb API (the most important
change was in the ldb_msg_add_*() routines, which now use the msg as a context, and thus it needs to be a talloc ptr) (This used to be commit 1a4713bfd0e519f3eb7b3241121ff914a6eeef18)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/db_wrap.c1
-rw-r--r--source4/lib/registry/reg_backend_ldb.c12
2 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c
index e9055399ad..a9ca7e3e0a 100644
--- a/source4/lib/db_wrap.c
+++ b/source4/lib/db_wrap.c
@@ -92,6 +92,7 @@ struct ldb_wrap *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
talloc_free(w);
return NULL;
}
+ talloc_steal(w, w->ldb);
talloc_set_destructor(w, ldb_wrap_destructor);
ldb_set_debug(w->ldb, ldb_wrap_debug, NULL);
diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c
index ffb9215cf0..e0d7b6e2cb 100644
--- a/source4/lib/registry/reg_backend_ldb.c
+++ b/source4/lib/registry/reg_backend_ldb.c
@@ -261,17 +261,17 @@ static WERROR ldb_open_hive(struct registry_hive *hive, struct registry_key **k)
static WERROR ldb_add_key (TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sd, struct registry_key **newkey)
{
struct ldb_context *ctx = parent->hive->backend_data;
- struct ldb_message msg;
+ struct ldb_message *msg;
struct ldb_key_data *newkd;
int ret;
- ZERO_STRUCT(msg);
+ msg = ldb_msg_new(mem_ctx);
- msg.dn = reg_path_to_ldb(mem_ctx, parent, name, NULL);
+ msg->dn = reg_path_to_ldb(msg, parent, name, NULL);
- ldb_msg_add_string(ctx, &msg, "key", talloc_strdup(mem_ctx, name));
+ ldb_msg_add_string(ctx, msg, "key", talloc_strdup(mem_ctx, name));
- ret = ldb_add(ctx, &msg);
+ ret = ldb_add(ctx, msg);
if (ret < 0) {
DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parent->hive->backend_data)));
return WERR_FOOBAR;
@@ -281,7 +281,7 @@ static WERROR ldb_add_key (TALLOC_CTX *mem_ctx, struct registry_key *parent, con
(*newkey)->name = talloc_strdup(mem_ctx, name);
(*newkey)->backend_data = newkd = talloc_zero_p(*newkey, struct ldb_key_data);
- newkd->dn = msg.dn;
+ newkd->dn = talloc_steal(newkd, msg->dn);
return WERR_OK;
}