s4 upgradeprovision: do not copy RID Set it's automaticaly created by the RID manager
authorMatthieu Patou <mat@matws.net>
Mon, 5 Jul 2010 19:46:46 +0000 (23:46 +0400)
committerMatthieu Patou <mat@matws.net>
Mon, 12 Jul 2010 21:06:39 +0000 (01:06 +0400)
source4/scripting/bin/upgradeprovision

index c22f3ce43b0b90211c3820904014fa606da96ef1..46c6b813cb6916fc76af20761e70c0226fa5be15 100755 (executable)
@@ -516,30 +516,38 @@ def add_missing_object(ref_samdb, samdb, dn, names, basedn, hash, index):
     empty = Message()
     delta = samdb.msg_diff(empty, reference[0])
     delta.dn
-    if delta.get("objectSid"):
-        sid = str(ndr_unpack(security.dom_sid, str(reference[0]["objectSid"])))
-        m = re.match(r".*-(\d+)$", sid)
-        if m and int(m.group(1))>999:
-            delta.remove("objectSid")
-    for att in hashAttrNotCopied.keys():
-        delta.remove(att)
-    for att in backlinked:
-        delta.remove(att)
-    depend_on_yettobecreated = None
-    for att in dn_syntax_att:
-        depend_on_yet_tobecreated = check_dn_nottobecreated(hash, index,
-                                                            delta.get(str(att)))
-        if depend_on_yet_tobecreated is not None:
-            message(CHANGE, "Object %s depends on %s in attribute %s,"
-                            "delaying the creation" % (dn,
-                                      depend_on_yet_tobecreated, att))
-            return False
-
-    delta.dn = dn
-    message(CHANGE,"Object %s will be added" % dn)
-    samdb.add(delta, ["relax:0"])
-
-    return True
+    skip = False
+    try:
+        if str(reference[0].get("cn"))  == "RID Set":
+            skip = True
+    finally:
+        if delta.get("objectSid"):
+            sid = str(ndr_unpack(security.dom_sid, str(reference[0]["objectSid"])))
+            m = re.match(r".*-(\d+)$", sid)
+            if m and int(m.group(1))>999:
+                delta.remove("objectSid")
+        for att in hashAttrNotCopied.keys():
+            delta.remove(att)
+        for att in backlinked:
+            delta.remove(att)
+        depend_on_yettobecreated = None
+        for att in dn_syntax_att:
+            depend_on_yet_tobecreated = check_dn_nottobecreated(hash, index,
+                                                                delta.get(str(att)))
+            if depend_on_yet_tobecreated is not None:
+                message(CHANGE, "Object %s depends on %s in attribute %s,"
+                                "delaying the creation" % (dn,
+                                          depend_on_yet_tobecreated, att))
+                return False
+
+        delta.dn = dn
+        if not skip:
+            message(CHANGE,"Object %s will be added" % dn)
+            samdb.add(delta, ["relax:0"])
+        else:
+            message(CHANGE,"Object %s was skipped" % dn)
+
+        return True
 
 def gen_dn_index_hash(listMissing):
     """Generate a hash associating the DN to its creation order