summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-11-30 02:37:35 +0300
committerAndrew Bartlett <abartlet@samba.org>2009-12-15 10:04:04 +1100
commit335731962092033d90374a785294b2fd55515310 (patch)
tree124357df209c3ce5d5a868847430b4a023c8dba9
parentf871de7def8dcb180f34b04eff182600607c9f87 (diff)
downloadsamba-335731962092033d90374a785294b2fd55515310.tar.gz
samba-335731962092033d90374a785294b2fd55515310.tar.bz2
samba-335731962092033d90374a785294b2fd55515310.zip
s4: reorder action to permit old provision to be correctly upgraded
-rwxr-xr-xsource4/scripting/bin/upgradeprovision13
1 files changed, 8 insertions, 5 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 48f67476a4..ae84c9586b 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -495,6 +495,7 @@ def check_diff_name(newpaths,paths,creds,session,basedn,names,ischema):
# Connect to the reference provision and get all the attribute in the partition referred by name
newsam_ldb = Ldb(newpaths.samdb, session_info=session, credentials=creds,lp=lp)
sam_ldb = Ldb(paths.samdb, session_info=session, credentials=creds,lp=lp, options=["modules:samba_dsdb"])
+ sam_ldb.transaction_start()
if ischema:
res = newsam_ldb.search(expression="objectClass=*",base=basedn, scope=SCOPE_SUBTREE,attrs=["dn"])
res2 = sam_ldb.search(expression="objectClass=*",base=basedn, scope=SCOPE_SUBTREE,attrs=["dn"])
@@ -502,6 +503,7 @@ def check_diff_name(newpaths,paths,creds,session,basedn,names,ischema):
res = newsam_ldb.search(expression="objectClass=*",base=basedn, scope=SCOPE_SUBTREE,attrs=["dn"],controls=["search_options:1:2"])
res2 = sam_ldb.search(expression="objectClass=*",base=basedn, scope=SCOPE_SUBTREE,attrs=["dn"],controls=["search_options:1:2"])
+ sam_ldb.transaction_commit()
# Create a hash for speeding the search of new object
for i in range(0,len(res)):
hash_new[str(res[i]["dn"]).lower()] = res[i]["dn"]
@@ -533,9 +535,10 @@ def check_diff_name(newpaths,paths,creds,session,basedn,names,ischema):
sam_ldb.set_schema_from_ldb(schema.ldb)
# And now we can connect to the DB - the schema won't be loaded from the DB
sam_ldb.connect(paths.samdb)
- sam_ldb.transaction_start()
else:
- sam_ldb.transaction_start()
+ sam_ldb = Ldb(paths.samdb, session_info=session, credentials=creds,lp=lp, options=["modules:samba_dsdb"])
+
+ sam_ldb.transaction_start()
empty = ldb.Message()
message(SIMPLE,"There are %d missing objects"%(len(listMissing)))
@@ -762,12 +765,12 @@ newpaths = get_paths(targetdir=provisiondir)
populate_backlink(newpaths,creds,session,names.schemadn)
# Check the difference
update_basesamdb(newpaths,paths,names)
-update_secrets(newpaths,paths,creds,session)
-update_privilege(newpaths,paths)
-update_machine_account_password(paths,creds,session,names)
if opts.full:
update_samdb(newpaths,paths,creds,session,names)
+update_secrets(newpaths,paths,creds,session)
+update_privilege(newpaths,paths)
+update_machine_account_password(paths,creds,session,names)
# SD should be created with admin but as some previous acl were so wrong that admin can't modify them we have first
# to recreate them with the good form but with system account and then give the ownership to admin ...
admin_session_info = admin_session(lp, str(names.domainsid))