From: Matthias Dieter Wallnöfer Date: Thu, 13 May 2010 13:29:20 +0000 (+0200) Subject: s4:domainlevel.py - update the script to handle both domain level occourrences on s4 X-Git-Tag: samba-3.6.0pre1~2034 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4da42b4e80caba436e44a7f6e6583028d0225da3;p=thirdparty%2Fsamba.git 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). --- diff --git a/source4/scripting/python/samba/netcmd/domainlevel.py b/source4/scripting/python/samba/netcmd/domainlevel.py index f7e67a2eda5..310747a3dee 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!")