dsdb: Use samdb_system_container_dn() in samldb.c
authorAndrew Bartlett <abartlet@samba.org>
Thu, 27 Jul 2023 04:29:34 +0000 (16:29 +1200)
committerStefan Metzmacher <metze@samba.org>
Mon, 31 Jul 2023 06:18:33 +0000 (06:18 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=9959

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/dsdb/samdb/ldb_modules/samldb.c

index 1b4921a6f2e9ef5d2d4c88bb3183f22bce8192ba..1edcba7223d0b637b4bc37795fe74fc2156e5450 100644 (file)
@@ -5402,14 +5402,9 @@ static int check_rename_constraints(struct ldb_message *msg,
 
        /* Objects under CN=System */
 
-       dn1 = ldb_dn_copy(ac, ldb_get_default_basedn(ldb));
+       dn1 = samdb_system_container_dn(ldb, ac);
        if (dn1 == NULL) return ldb_oom(ldb);
 
-       if ( ! ldb_dn_add_child_fmt(dn1, "CN=System")) {
-               talloc_free(dn1);
-               return LDB_ERR_OPERATIONS_ERROR;
-       }
-
        if ((ldb_dn_compare_base(dn1, olddn) == 0) &&
            (ldb_dn_compare_base(dn1, newdn) != 0)) {
                talloc_free(dn1);