r21503: add usefull function to get the site dn for the local server
authorStefan Metzmacher <metze@samba.org>
Thu, 22 Feb 2007 15:53:06 +0000 (15:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:48:46 +0000 (14:48 -0500)
metze

source/dsdb/samdb/samdb.c

index a3ac2c9544c21b5be221af1aed37567c5415e441..dab2a2322629d1e1a1e2559039fa33b04bb04371 100644 (file)
@@ -1383,6 +1383,23 @@ struct ldb_dn *samdb_server_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
        return ldb_dn_get_parent(mem_ctx, samdb_ntds_settings_dn(ldb));
 }
 
+/*
+  work out the server dn for the current open ldb
+*/
+struct ldb_dn *samdb_server_site_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx)
+{
+       struct ldb_dn *server_dn;
+       struct ldb_dn *server_site_dn;
+
+       server_dn = samdb_server_dn(ldb, mem_ctx);
+       if (!server_dn) return NULL;
+
+       server_site_dn = ldb_dn_get_parent(mem_ctx, server_dn);
+
+       talloc_free(server_dn);
+       return server_site_dn;
+}
+
 /*
   work out if we are the PDC for the domain of the current open ldb
 */