summaryrefslogtreecommitdiff
path: root/source4/scripting/bin
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-11-27 20:50:04 +0300
committerAndrew Bartlett <abartlet@samba.org>2009-12-01 12:17:32 +1100
commitbf2c1e9c4f6fa7d1ea778f54593c308b56efacd2 (patch)
tree3a2639dbcf544c5fbeda81418ec2b7ea7f7b12bd /source4/scripting/bin
parentf65360840a43616d870b0f26925067f248aa6376 (diff)
downloadsamba-bf2c1e9c4f6fa7d1ea778f54593c308b56efacd2.tar.gz
samba-bf2c1e9c4f6fa7d1ea778f54593c308b56efacd2.tar.bz2
samba-bf2c1e9c4f6fa7d1ea778f54593c308b56efacd2.zip
s4: load the domain level of the current provision and create a provision with the same domain level
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/upgradeprovision10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision
index 2f0ce84653..9eb3ba3a98 100755
--- a/source4/scripting/bin/upgradeprovision
+++ b/source4/scripting/bin/upgradeprovision
@@ -39,7 +39,7 @@ from base64 import b64encode
import samba
from samba.credentials import DONT_USE_KERBEROS
from samba.auth import system_session, admin_session
-from samba import Ldb
+from samba import Ldb, DS_DOMAIN_FUNCTION_2000, DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2008, DS_DC_FUNCTION_2008_R2
from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError
import ldb
import samba.getopt as options
@@ -222,10 +222,14 @@ def guess_names_from_current_provision(credentials,session_info,paths):
names.ntdsguid = str(ndr_unpack( misc.GUID,res5[0]["objectGUID"][0]))
# domain guid/sid
- attrs6 = ["objectGUID", "objectSid", ]
+ attrs6 = ["objectGUID", "objectSid","msDS-Behavior-Version" ]
res6 = samdb.search(expression="(objectClass=*)",base=basedn, scope=SCOPE_BASE, attrs=attrs6)
names.domainguid = str(ndr_unpack( misc.GUID,res6[0]["objectGUID"][0]))
names.domainsid = ndr_unpack( security.dom_sid,res6[0]["objectSid"][0])
+ if res6[0].get("msDS-Behavior-Version") == None or int(res6[0]["msDS-Behavior-Version"][0]) < DS_DOMAIN_FUNCTION_2000:
+ names.domainlevel = DS_DOMAIN_FUNCTION_2000
+ else:
+ names.domainlevel = int(res6[0]["msDS-Behavior-Version"][0])
# policy guid
attrs7 = ["cn","displayName"]
@@ -262,6 +266,7 @@ def print_names(names):
message(GUESS, "domainsid :"+str(names.domainsid))
message(GUESS, "domainguid :"+names.domainguid)
message(GUESS, "ntdsguid :"+names.ntdsguid)
+ message(GUESS, "domainlevel :"+str(names.domainlevel))
# Create a fresh new reference provision
# This provision will be the reference for knowing what has changed in the
@@ -297,6 +302,7 @@ def newprovision(names,setup_dir,creds,session,smbconf):
slapd_path=None,
setup_ds_path=None,
nosync=None,
+ dom_for_fun_level=names.domainlevel,
ldap_dryrun_mode=None)
return provdir