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)
committerJule Anger <janger@samba.org>
Tue, 1 Aug 2023 09:53:17 +0000 (09:53 +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>
(cherry picked from commit 97b682e0eb0450513dcecb74be672e18e84fe7a2)

source4/dsdb/samdb/ldb_modules/samldb.c

index 3ecbd00e68e26fab1a6b82157b71a20578cf35bb..d501973ac338e0f7aedaff50f0b281b093a02316 100644 (file)
@@ -5390,14 +5390,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);