summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-09-05 02:59:20 +0400
committerMatthieu Patou <mat@matws.net>2010-09-05 12:29:21 +0400
commitb1535582100a551cedc245f12cf63a1340985bdd (patch)
tree84284c93cbad921f26668bf41e4c73c740845dc6 /source4
parent13d575d6e320961153d7071bc4f9b5cccdfb71b6 (diff)
downloadsamba-b1535582100a551cedc245f12cf63a1340985bdd.tar.gz
samba-b1535582100a551cedc245f12cf63a1340985bdd.tar.bz2
samba-b1535582100a551cedc245f12cf63a1340985bdd.zip
upgradeprovision: do not try to remove/change attribute before the RID Set object is present
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/upgradeprovision34
1 files changed, 28 insertions, 6 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 046474ff5d..39b5042da4 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -478,14 +478,27 @@ def handle_special_add(samdb, dn, names):
base=str(names.rootdn),
scope=SCOPE_SUBTREE, attrs=["dn"],
controls=["search_options:1:2"])
- if len(res) > 0:
+
+ res2 = samdb.search(expression="(dn=%s)" % dn,
+ base=str(names.rootdn),
+ scope=SCOPE_SUBTREE, attrs=["dn"],
+ controls=["search_options:1:2"])
+
+ if len(res) > 0 and len(res2) == 0:
message(CHANGE, "Existing object %s must be replaced by %s,"
"Renaming old object" % (str(oldDn), str(dn)))
- samdb.rename(oldDn, objDn)
+ samdb.rename(oldDn, objDn, ["relax:0"])
- return 1
+ return 0
if dntoremove is not None:
+ res = samdb.search(expression="(cn=RID Set)",
+ base=str(names.rootdn),
+ scope=SCOPE_SUBTREE, attrs=["dn"],
+ controls=["search_options:1:2"])
+
+ if len(res) == 0:
+ return 2
res = samdb.search(expression="(dn=%s)" % dntoremove,
base=str(names.rootdn),
scope=SCOPE_SUBTREE, attrs=["dn"],
@@ -494,7 +507,9 @@ def handle_special_add(samdb, dn, names):
message(CHANGE, "Existing object %s must be replaced by %s,"
"removing old object" % (dntoremove, str(dn)))
samdb.delete(res[0]["dn"])
- return 0
+ return 0
+
+ return 1
def check_dn_nottobecreated(hash, index, listdn):
@@ -541,8 +556,15 @@ def add_missing_object(ref_samdb, samdb, dn, names, basedn, hash, index):
:param index: Current creation order
:return: True if the object was created False otherwise"""
- if handle_special_add(samdb, dn, names):
- return
+ ret = handle_special_add(samdb, dn, names)
+
+ if ret == 2:
+ return False
+
+ if ret == 0:
+ return True
+
+
reference = ref_samdb.search(expression="dn=%s" % (str(dn)), base=basedn,
scope=SCOPE_SUBTREE, controls=["search_options:1:2"])
empty = Message()