diff options
Diffstat (limited to 'source4/dsdb/samdb/samdb.c')
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 39 |
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"); } |