From 966b5d5de2fc40ff77e2b947c61a2419795a2282 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 16 Sep 2011 15:15:35 +1000 Subject: pyldb: fixed places where we try to concatenate a Dn with a string you need to either use str(dn) or use %s in a format string --- source4/scripting/python/samba/netcmd/domain.py | 10 +++++----- source4/scripting/python/samba/netcmd/fsmo.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/scripting/python') diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index f7e060f730..0ab35a63aa 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," + samdb.get_config_basedn(), + res_forest = samdb.search("CN=Partitions,%s" % 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," + samdb.get_config_basedn(), + res_dc_s = samdb.search("CN=Sites,%s" % samdb.get_config_basedn(), scope=ldb.SCOPE_SUBTREE, expression="(objectClass=nTDSDSA)", attrs=["msDS-Behavior-Version"]) assert len(res_dc_s) >= 1 @@ -279,7 +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," + ldb.get_config_basedn()) + m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") + ",CN=Partitions,%s" % ldb.get_config_basedn()) m["nTMixedDomain"] = ldb.MessageElement("0", ldb.FLAG_MOD_REPLACE, "nTMixedDomain") try: @@ -298,7 +298,7 @@ class cmd_domain_level(Command): # Under partitions m = ldb.Message() m.dn = ldb.Dn(samdb, "CN=" + lp.get("workgroup") - + ",CN=Partitions," + ldb.get_config_basedn()) + + ",CN=Partitions,%s" % ldb.get_config_basedn()) m["msDS-Behavior-Version"]= ldb.MessageElement( str(new_level_domain), ldb.FLAG_MOD_REPLACE, "msDS-Behavior-Version") @@ -323,7 +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," + ldb.get_config_basedn()) + m.dn = ldb.Dn(samdb, "CN=Partitions,%s" % 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 78a2014825..06a2de1c2c 100644 --- a/source4/scripting/python/samba/netcmd/fsmo.py +++ b/source4/scripting/python/samba/netcmd/fsmo.py @@ -139,7 +139,7 @@ class cmd_fsmo_show(Command): domain_dn = samdb.domain_dn() self.infrastructure_dn = "CN=Infrastructure," + domain_dn - self.naming_dn = "CN=Partitions," + samdb.get_config_basedn() + self.naming_dn = "CN=Partitions,%s" % samdb.get_config_basedn() self.schema_dn = samdb.get_schema_basedn() self.rid_dn = "CN=RID Manager$,CN=System," + domain_dn -- cgit