mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
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).
This commit is contained in:
@ -185,17 +185,42 @@ class cmd_domainlevel(Command):
|
|||||||
|
|
||||||
# Deactivate mixed/interim domain support
|
# Deactivate mixed/interim domain support
|
||||||
if level_domain_mixed != 0:
|
if level_domain_mixed != 0:
|
||||||
|
# Directly on the base DN
|
||||||
m = ldb.Message()
|
m = ldb.Message()
|
||||||
m.dn = ldb.Dn(samdb, domain_dn)
|
m.dn = ldb.Dn(samdb, domain_dn)
|
||||||
m["nTMixedDomain"] = ldb.MessageElement("0",
|
m["nTMixedDomain"] = ldb.MessageElement("0",
|
||||||
ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
|
ldb.FLAG_MOD_REPLACE, "nTMixedDomain")
|
||||||
samdb.modify(m)
|
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 = ldb.Message()
|
||||||
m.dn = ldb.Dn(samdb, domain_dn)
|
m.dn = ldb.Dn(samdb, domain_dn)
|
||||||
m["msDS-Behavior-Version"]= ldb.MessageElement(
|
m["msDS-Behavior-Version"]= ldb.MessageElement(
|
||||||
str(new_level_domain), ldb.FLAG_MOD_REPLACE,
|
str(new_level_domain), ldb.FLAG_MOD_REPLACE,
|
||||||
"msDS-Behavior-Version")
|
"msDS-Behavior-Version")
|
||||||
samdb.modify(m)
|
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
|
level_domain = new_level_domain
|
||||||
msgs.append("Domain function level changed!")
|
msgs.append("Domain function level changed!")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user