diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-09-16 11:18:05 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-09-19 10:57:03 +1000 |
commit | 579fd43057e5d838ef24a72af20203eda8199204 (patch) | |
tree | 0146d3bf78fd8d550ac53afc7300b00abca0edbf /source4/scripting | |
parent | ee7cfcadc60eac34bf646f765798ca5a01d311ed (diff) | |
download | samba-579fd43057e5d838ef24a72af20203eda8199204.tar.gz samba-579fd43057e5d838ef24a72af20203eda8199204.tar.bz2 samba-579fd43057e5d838ef24a72af20203eda8199204.zip |
samba-tool: use get_config_basedn() to get configuration NC DN
this allows these commands to work for subdomains
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/netcmd/domain.py | 12 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/fsmo.py | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 6f7001a9c7..f7e060f730 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -164,7 +164,7 @@ class cmd_domain_level(Command): domain_dn = samdb.domain_dn() - res_forest = samdb.search("CN=Partitions,CN=Configuration," + domain_dn, + res_forest = samdb.search("CN=Partitions," + samdb.get_config_basedn(), scope=ldb.SCOPE_BASE, attrs=["msDS-Behavior-Version"]) assert len(res_forest) == 1 @@ -172,7 +172,7 @@ class cmd_domain_level(Command): attrs=["msDS-Behavior-Version", "nTMixedDomain"]) assert len(res_domain) == 1 - res_dc_s = samdb.search("CN=Sites,CN=Configuration," + domain_dn, + res_dc_s = samdb.search("CN=Sites," + samdb.get_config_basedn(), scope=ldb.SCOPE_SUBTREE, expression="(objectClass=nTDSDSA)", attrs=["msDS-Behavior-Version"]) assert len(res_dc_s) >= 1 @@ -279,8 +279,7 @@ class cmd_domain_level(Command): samdb.modify(m) # Under partitions m = ldb.Message() - m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") - + ",CN=Partitions,CN=Configuration," + domain_dn) + m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") + ",CN=Partitions," + ldb.get_config_basedn()) m["nTMixedDomain"] = ldb.MessageElement("0", ldb.FLAG_MOD_REPLACE, "nTMixedDomain") try: @@ -299,7 +298,7 @@ class cmd_domain_level(Command): # Under partitions m = ldb.Message() m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") - + ",CN=Partitions,CN=Configuration," + domain_dn) + + ",CN=Partitions," + ldb.get_config_basedn()) m["msDS-Behavior-Version"]= ldb.MessageElement( str(new_level_domain), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") @@ -324,8 +323,7 @@ class cmd_domain_level(Command): if new_level_forest > level_domain: raise CommandError("Forest function level can't be higher than the domain function level(s). Please raise it/them first!") m = ldb.Message() - m.dn = ldb.Dn(samdb, "CN=Partitions,CN=Configuration," - + domain_dn) + m.dn = ldb.Dn(samdb, "CN=Partitions," + ldb.get_config_basedn()) m["msDS-Behavior-Version"]= ldb.MessageElement( str(new_level_forest), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") diff --git a/source4/scripting/python/samba/netcmd/fsmo.py b/source4/scripting/python/samba/netcmd/fsmo.py index 3e296dd83d..78a2014825 100644 --- a/source4/scripting/python/samba/netcmd/fsmo.py +++ b/source4/scripting/python/samba/netcmd/fsmo.py @@ -139,8 +139,8 @@ class cmd_fsmo_show(Command): domain_dn = samdb.domain_dn() self.infrastructure_dn = "CN=Infrastructure," + domain_dn - self.naming_dn = "CN=Partitions,CN=Configuration," + domain_dn - self.schema_dn = "CN=Schema,CN=Configuration," + domain_dn + self.naming_dn = "CN=Partitions," + samdb.get_config_basedn() + self.schema_dn = samdb.get_schema_basedn() self.rid_dn = "CN=RID Manager$,CN=System," + domain_dn res = samdb.search(self.infrastructure_dn, |