summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/samdb.c
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/samdb/samdb.c
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/samdb/samdb.c')
-rw-r--r--source4/dsdb/samdb/samdb.c39
1 files changed, 9 insertions, 30 deletions
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");
}