From 719a46913bed65932ebe696f441bd88ebd54819c Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 12 Apr 2010 14:15:34 +0200 Subject: s4:dsdb/common/util.c - add a call which determines centrally the forest DNS domainname --- source4/dsdb/common/util.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source4/dsdb/common') diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 5625e95096..d36e1ec1bb 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -3473,3 +3473,22 @@ int dsdb_search_one(struct ldb_context *ldb, return LDB_SUCCESS; } + +/* returns back the forest DNS name */ +const char *samdb_forest_name(struct ldb_context *ldb, TALLOC_CTX *mem_ctx) +{ + const char *forest_name = ldb_dn_canonical_string(mem_ctx, + ldb_get_root_basedn(ldb)); + char *p; + + if (forest_name == NULL) { + return NULL; + } + + p = strchr(forest_name, '/'); + if (p) { + *p = '\0'; + } + + return forest_name; +} -- cgit