summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-09-08 04:04:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:17:54 -0500
commitf140bd7e38947847a1bb9a42dbb9c6760e5c3756 (patch)
tree6bdb3c6b43eae184fa6565c7f4408518bd661d6e /source4/lib/ldb
parent89a39c7acbbd52464118b6c44d612d1f1b347ccf (diff)
downloadsamba-f140bd7e38947847a1bb9a42dbb9c6760e5c3756.tar.gz
samba-f140bd7e38947847a1bb9a42dbb9c6760e5c3756.tar.bz2
samba-f140bd7e38947847a1bb9a42dbb9c6760e5c3756.zip
r18245: Ensure we don't keep the rootdse record around (steal it onto the
correct memory context). Andrew Bartlett (This used to be commit b4f234e507fa94e9600c362fb6edb704d299cfce)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 04ac3e7d81..5aa243ac7a 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -162,12 +162,14 @@ static const struct ldb_dn *ldb_set_default_basedn(struct ldb_context *ldb)
tmp_ctx = talloc_new(ldb);
ret = ldb_search(ldb, ldb_dn_new(tmp_ctx), LDB_SCOPE_BASE,
"(objectClass=*)", attrs, &res);
- if (ret == LDB_SUCCESS && res->count == 1) {
- basedn = ldb_msg_find_attr_as_dn(ldb, res->msgs[0], "defaultNamingContext");
+ if (ret == LDB_SUCCESS) {
+ talloc_steal(tmp_ctx, res);
+ if (res->count == 1) {
+ basedn = ldb_msg_find_attr_as_dn(ldb, res->msgs[0], "defaultNamingContext");
+ ldb_set_opaque(ldb, "default_baseDN", basedn);
+ }
}
- ldb_set_opaque(ldb, "default_baseDN", basedn);
-
talloc_free(tmp_ctx);
return basedn;
}