summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-26 11:36:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:36 -0500
commitb4d171d4df67a8c95ff0e298e6dcaaf0aaa87373 (patch)
tree0cb73d0495288a8da6b0787843c087b5809379e2
parent81021aaa953661e711ba0030ab2644664587ad5b (diff)
downloadsamba-b4d171d4df67a8c95ff0e298e6dcaaf0aaa87373.tar.gz
samba-b4d171d4df67a8c95ff0e298e6dcaaf0aaa87373.tar.bz2
samba-b4d171d4df67a8c95ff0e298e6dcaaf0aaa87373.zip
r9643: fixed samsync code for the new dn explode semantics
(This used to be commit 96298af202f994c3d5d0c7f5dacd1197a740f766)
-rw-r--r--source4/libnet/libnet_samsync_ldb.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c
index 8d06ec84b6..f595880e8e 100644
--- a/source4/libnet/libnet_samsync_ldb.c
+++ b/source4/libnet/libnet_samsync_ldb.c
@@ -119,6 +119,8 @@ static NTSTATUS samsync_ldb_handle_domain(TALLOC_CTX *mem_ctx,
const char *domain_attrs[] = {"nETBIOSName", "nCName", NULL};
struct ldb_message **msgs_domain;
int ret_domain;
+ char *base_dn;
+
ret_domain = gendb_search(state->sam_ldb, mem_ctx, NULL, &msgs_domain, domain_attrs,
"(&(&(nETBIOSName=%s)(objectclass=crossRef))(ncName=*))",
domain_name);
@@ -130,24 +132,20 @@ static NTSTATUS samsync_ldb_handle_domain(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_SUCH_DOMAIN;
}
- state->base_dn[database]
- = talloc_steal(state, samdb_result_string(msgs_domain[0],
- "nCName", NULL));
-
- state->dom_sid[database]
- = talloc_steal(state,
- samdb_search_dom_sid(state->sam_ldb, state,
- state->base_dn[database], "objectSid", "dn=%s",
- ldb_dn_linearize(mem_ctx, state->base_dn[database])));
+ state->base_dn[database] = samdb_result_dn(state, msgs_domain[0], "nCName", NULL);
+
+ base_dn = ldb_dn_linearize(mem_ctx, state->base_dn[database]);
+
+ state->dom_sid[database] = samdb_search_dom_sid(state->sam_ldb, state,
+ state->base_dn[database],
+ "objectSid", "dn=%s", base_dn);
} else if (database == SAM_DATABASE_BUILTIN) {
- /* work out the builtin_dn - useful for so many calls its worth
- fetching here */
- state->base_dn[database]
- = talloc_steal(state,
- samdb_search_string(state->sam_ldb, mem_ctx, NULL,
- "dn", "objectClass=builtinDomain"));
- state->dom_sid[database]
- = dom_sid_parse_talloc(state, SID_BUILTIN);
+ /* work out the builtin_dn - useful for so many calls its worth
+ fetching here */
+ const char *dnstring = samdb_search_string(state->sam_ldb, mem_ctx, NULL,
+ "dn", "objectClass=builtinDomain");
+ state->base_dn[database] = ldb_dn_explode(state, dnstring);
+ state->dom_sid[database] = dom_sid_parse_talloc(state, SID_BUILTIN);
} else {
/* PRIVs DB */
return NT_STATUS_INVALID_PARAMETER;