summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-13 15:29:20 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-13 15:33:11 +0200
commit4da42b4e80caba436e44a7f6e6583028d0225da3 (patch)
tree18d002485ff9496f44296f87412616105f3ce7a7
parent38e9a7f5778eeff9c87cbb3812c8b0261b018b69 (diff)
downloadsamba-4da42b4e80caba436e44a7f6e6583028d0225da3.tar.gz
samba-4da42b4e80caba436e44a7f6e6583028d0225da3.tar.bz2
samba-4da42b4e80caba436e44a7f6e6583028d0225da3.zip
s4:domainlevel.py - update the script to handle both domain level occourrences on s4
The second "modify" is located under a try-catch block to ignore the change failure against Windows Server (there only the first change is required).
-rw-r--r--source4/scripting/python/samba/netcmd/domainlevel.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/netcmd/domainlevel.py b/source4/scripting/python/samba/netcmd/domainlevel.py
index f7e67a2eda..310747a3de 100644
--- a/source4/scripting/python/samba/netcmd/domainlevel.py
+++ b/source4/scripting/python/samba/netcmd/domainlevel.py
@@ -185,17 +185,42 @@ class cmd_domainlevel(Command):
# Deactivate mixed/interim domain support
if level_domain_mixed != 0:
+ # Directly on the base DN
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
m["nTMixedDomain"] = ldb.MessageElement("0",
ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
samdb.modify(m)
+ # Under partitions
+ m = ldb.Message()
+ m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup")
+ + ",CN=Partitions,CN=Configuration," + domain_dn)
+ m["nTMixedDomain"] = ldb.MessageElement("0",
+ ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
+ try:
+ samdb.modify(m)
+ except LdbError, (num, _):
+ pass
+
+ # Directly on the base DN
m = ldb.Message()
m.dn = ldb.Dn(samdb, domain_dn)
m["msDS-Behavior-Version"]= ldb.MessageElement(
str(new_level_domain), ldb.FLAG_MOD_REPLACE,
"msDS-Behavior-Version")
samdb.modify(m)
+ # Under partitions
+ m = ldb.Message()
+ m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup")
+ + ",CN=Partitions,CN=Configuration," + domain_dn)
+ m["msDS-Behavior-Version"]= ldb.MessageElement(
+ str(new_level_domain), ldb.FLAG_MOD_REPLACE,
+ "msDS-Behavior-Version")
+ try:
+ samdb.modify(m)
+ except LdbError, (num, _):
+ pass
+
level_domain = new_level_domain
msgs.append("Domain function level changed!")