summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-07-05 01:00:13 +0400
committerAndrew Bartlett <abartlet@samba.org>2010-07-15 22:08:21 +1000
commit7478224189598f192065b91d57080f1dd1719a99 (patch)
tree745885267976ac0c2e77a5e1ca9223fd7ba373b9 /source4/scripting
parent0a1b1121c48e26c5218e2ccc0c8a8cc724b96624 (diff)
downloadsamba-7478224189598f192065b91d57080f1dd1719a99.tar.gz
samba-7478224189598f192065b91d57080f1dd1719a99.tar.bz2
samba-7478224189598f192065b91d57080f1dd1719a99.zip
s4 upgradeprovision: Synchronize the calculated keyversionnumber with the one previously stored
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting')
-rwxr-xr-xsource4/scripting/bin/upgradeprovision23
1 files changed, 22 insertions, 1 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 888f3a8256..f073dbcad7 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -56,7 +56,9 @@ from samba.upgradehelpers import (dn_sort, get_paths, newprovision,
CHANGEALL, GUESS, CHANGESD, PROVISION,
updateOEMInfo, getOEMInfo, update_gpo,
delta_update_basesamdb, update_policyids,
- update_machine_account_password)
+ update_machine_account_password,
+ search_constructed_attrs_stored,
+ increment_calculated_keyversion_number)
replace=2**FLAG_MOD_REPLACE
add=2**FLAG_MOD_ADD
@@ -1299,6 +1301,23 @@ def backup_provision(paths, dir):
else:
shutil.copytree(samldbdir, os.path.join(dir, "sam.ldb.d"))
+
+
+
+def sync_calculated_attributes(samdb, names):
+ """Synchronize attributes used for constructed ones, with the
+ old constructed that were stored in the database.
+
+ This apply for instance to msds-keyversionnumber that was
+ stored and that is now constructed from replpropertymetadata.
+
+ :param samdb: An LDB object attached to the currently upgraded samdb
+ :param names: Various key parameter about current provision.
+ """
+ listAttrs = ["msDs-KeyVersionAttribute"]
+ hash = search_constructed_attrs_stored(samdb, names.rootdn, listAttrs)
+ increment_calculated_keyversion_number(samdb, names.rootdn, hash)
+
def setup_path(file):
return os.path.join(setup_dir, file)
@@ -1546,6 +1565,8 @@ if __name__ == '__main__':
new_ldbs.groupedRollback()
shutil.rmtree(provisiondir)
sys.exit(1)
+ else:
+ sync_calculated_attributes(ldbs.sam, names)
# 14)
update_secrets(new_ldbs.secrets, ldbs.secrets, message)
# 15)