]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dsdb: Add new function samdb_system_container_dn()
authorAndrew Bartlett <abartlet@samba.org>
Thu, 27 Jul 2023 04:12:11 +0000 (16:12 +1200)
committerJule Anger <janger@samba.org>
Tue, 1 Aug 2023 09:53:12 +0000 (09:53 +0000)
This will replace many calls crafting or searching for this DN
elsewhere in the code.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9959

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 25b0e1102e1a502152d2695aeddf7c65555b16fb)

source4/dsdb/common/util.c

index 39b29cd2a0c976251f80d1aa4b25814a712f5202..59d1f7eba587624865553a1061e25d793bd72a45 100644 (file)
@@ -1241,6 +1241,25 @@ struct ldb_dn *samdb_infrastructure_dn(struct ldb_context *sam_ctx, TALLOC_CTX *
        return new_dn;
 }
 
+struct ldb_dn *samdb_system_container_dn(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx)
+{
+       struct ldb_dn *new_dn = NULL;
+       bool ok;
+
+       new_dn = ldb_dn_copy(mem_ctx, ldb_get_default_basedn(sam_ctx));
+       if (new_dn == NULL) {
+               return NULL;
+       }
+
+       ok = ldb_dn_add_child_fmt(new_dn, "CN=System");
+       if (!ok) {
+               TALLOC_FREE(new_dn);
+               return NULL;
+       }
+
+       return new_dn;
+}
+
 struct ldb_dn *samdb_sites_dn(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx)
 {
        struct ldb_dn *new_dn;