summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-08-25 07:32:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:45 -0500
commitb21b119cbcff175453173d7061e3be3888dc8ec3 (patch)
treea83ace4202a076adc4cdbcf772c4da2ba82fdcf5 /source4/dsdb
parent0fd98079425cff37c45be824ffa2695458ff12f3 (diff)
downloadsamba-b21b119cbcff175453173d7061e3be3888dc8ec3.tar.gz
samba-b21b119cbcff175453173d7061e3be3888dc8ec3.tar.bz2
samba-b21b119cbcff175453173d7061e3be3888dc8ec3.zip
r17824: add a wrapper for the common partitions_basedn calculation
(This used to be commit 09007b0907662a0d147e8eb21d5bdfc90dbffefc)
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/cracknames.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c2
-rw-r--r--source4/dsdb/samdb/samdb.c39
3 files changed, 12 insertions, 33 deletions
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index e8fd1fa71b..76bc80689b 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -577,7 +577,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
const char * const *result_attrs;
struct ldb_message **result_res = NULL;
const struct ldb_dn *result_basedn;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn = samdb_partitions_dn(sam_ctx, mem_ctx);
const char * const _domain_attrs_1779[] = { "ncName", "dnsRoot", NULL};
const char * const _result_attrs_null[] = { NULL };
@@ -627,7 +627,7 @@ static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_
"%s", domain_filter);
} else {
ldb_ret = gendb_search(sam_ctx, mem_ctx, partitions_basedn, &domain_res, domain_attrs,
- "(ncName=%s)", ldb_dn_linearize(mem_ctx, samdb_base_dn(mem_ctx)));
+ "(ncName=%s)", ldb_dn_linearize(mem_ctx, samdb_base_dn(sam_ctx)));
}
switch (ldb_ret) {
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 273cc60c30..e8b9307cf5 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -489,7 +489,7 @@ static int build_domain_data_request(struct ph_context *ac)
return LDB_ERR_OPERATIONS_ERROR;
}
ac->dom_req->operation = LDB_SEARCH;
- ac->dom_req->op.search.base = samdb_base_dn(ac);
+ ac->dom_req->op.search.base = ldb_auto_basedn(ac->module->ldb);
ac->dom_req->op.search.scope = LDB_SCOPE_SUBTREE;
filter = talloc_asprintf(ac->dom_req, "(&(objectSid=%s)(|(objectClass=domain)(objectClass=builtinDomain)))",
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index 4027203b24..dd671e6a2b 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -1024,38 +1024,17 @@ struct security_descriptor *samdb_default_security_descriptor(TALLOC_CTX *mem_ct
return sd;
}
-const struct ldb_dn *samdb_base_dn(TALLOC_CTX *mem_ctx)
+const struct ldb_dn *samdb_base_dn(struct ldb_context *sam_ctx)
{
- TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- int server_role = lp_server_role();
- const char **split_realm;
- struct ldb_dn *dn;
-
- if (!tmp_ctx) {
- return NULL;
- }
+ return ldb_auto_basedn(sam_ctx);
+}
- if ((server_role == ROLE_DOMAIN_PDC)
- || (server_role == ROLE_DOMAIN_BDC)) {
- int i;
- split_realm = str_list_make(tmp_ctx, lp_realm(), ".");
- if (!split_realm) {
- talloc_free(tmp_ctx);
- return NULL;
- }
- dn = NULL;
- i = str_list_length(split_realm);
- i--;
- for (; i >= 0; i--) {
- dn = ldb_dn_build_child(tmp_ctx, "dc", split_realm[i], dn);
- if (!dn) {
- talloc_free(tmp_ctx);
- return NULL;
- }
- }
- return dn;
- }
- return ldb_dn_string_compose(mem_ctx, NULL, "cn=%s", lp_netbios_name());
+
+const struct ldb_dn *samdb_partitions_dn(struct ldb_context *sam_ctx,
+ TALLOC_CTX *mem_ctx)
+{
+ return ldb_dn_string_compose(mem_ctx, samdb_base_dn(sam_ctx),
+ "CN=Partitions,CN=Configuration");
}