From 9aaacee6cd19adf615f941771fe9d490b7dae3c4 Mon Sep 17 00:00:00 2001 From: Nadezhda Ivanova Date: Wed, 22 Dec 2010 12:19:46 +0200 Subject: s4-dsdb: Added a helper function to get the default dns domain as string. --- source4/dsdb/common/util.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 36f69337a6..b2d4be0068 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -3952,6 +3952,25 @@ const char *samdb_forest_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx) return forest_name; } +/* returns back the default domain DNS name */ +const char *samdb_default_domain_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx) +{ + const char *domain_name = ldb_dn_canonical_string(mem_ctx, + ldb_get_default_basedn(ldb)); + char *p; + + if (domain_name == NULL) { + return NULL; + } + + p = strchr(domain_name, '/'); + if (p) { + *p = '\0'; + } + + return domain_name; +} + /* validate that an DSA GUID belongs to the specified user sid. The user SID must be a domain controller account (either RODC or -- cgit