objectclass: Ensure that backlinks are not replicated
authorGarming Sam <garming@catalyst.net.nz>
Tue, 5 Sep 2017 04:03:04 +0000 (16:03 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Dec 2017 07:20:15 +0000 (08:20 +0100)
Adprep schema adds backlinks, but they do not have the NOT_REPLICATED
bit. We need to force this in locally to ensure we have it.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/objectclass.c

index c9301496a261f8d6de560588b5c8e7ddd262a78e..36ab76e19fc79f215a348ce6545e0f2c21bb2c2e 100644 (file)
@@ -405,6 +405,7 @@ static int objectclass_do_add(struct oc_context *ac)
        }
 
        if (ac->schema != NULL) {
+               unsigned int linkID = 0;
                /*
                 * Notice: by the normalization function call in "ldb_request()"
                 * case "LDB_ADD" we have always only *one* "objectClass"
@@ -606,6 +607,11 @@ static int objectclass_do_add(struct oc_context *ac)
                }
                /* TODO: If parent object is site or subnet, also add (SYSTEM_FLAG_CONFIG_ALLOW_RENAME) */
 
+               linkID = ldb_msg_find_attr_as_int(msg, "linkID", 0);
+               if (linkID > 0 && linkID % 2 == 1) {
+                       systemFlags |= DS_FLAG_ATTR_NOT_REPLICATED;
+               }
+
                if (el || systemFlags != 0) {
                        ret = samdb_msg_add_int(ldb, msg, msg, "systemFlags",
                                                systemFlags);