diff options
-rw-r--r-- | python/samba/dbchecker.py | 10 | ||||
-rw-r--r-- | python/samba/descriptor.py | 4 | ||||
-rw-r--r-- | python/samba/join.py | 4 | ||||
-rw-r--r-- | python/samba/kcc/__init__.py | 2 | ||||
-rw-r--r-- | python/samba/netcmd/fsmo.py | 6 | ||||
-rw-r--r-- | python/samba/provision/__init__.py | 6 | ||||
-rw-r--r-- | python/samba/remove_dc.py | 4 | ||||
-rw-r--r-- | python/samba/tests/kcc/ldif_import_export.py | 4 | ||||
-rw-r--r-- | source4/dsdb/tests/python/rodc_rwdc.py | 6 | ||||
-rwxr-xr-x | source4/dsdb/tests/python/token_group.py | 4 | ||||
-rw-r--r-- | source4/torture/drs/python/getnc_exop.py | 4 | ||||
-rw-r--r-- | source4/torture/drs/python/ridalloc_exop.py | 23 |
12 files changed, 38 insertions, 39 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index bdcbc34e011..9d72fc6ca94 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -144,11 +144,11 @@ class dbcheck(object): for nc in self.ncs: try: - dn = self.samdb.get_wellknown_dn(ldb.Dn(self.samdb, nc), + dn = self.samdb.get_wellknown_dn(ldb.Dn(self.samdb, nc.decode('utf8')), dsdb.DS_GUID_DELETED_OBJECTS_CONTAINER) self.deleted_objects_containers.append(dn) except KeyError: - self.ncs_lacking_deleted_containers.append(ldb.Dn(self.samdb, nc)) + self.ncs_lacking_deleted_containers.append(ldb.Dn(self.samdb, nc.decode('utf8'))) domaindns_zone = 'DC=DomainDnsZones,%s' % self.samdb.get_default_basedn() forestdns_zone = 'DC=ForestDnsZones,%s' % self.samdb.get_root_basedn() @@ -178,13 +178,13 @@ class dbcheck(object): res = self.samdb.search(base=ldb.Dn(self.samdb, self.samdb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - self.server_ref_dn = ldb.Dn(self.samdb, res[0]['serverReference'][0]) + self.server_ref_dn = ldb.Dn(self.samdb, res[0]['serverReference'][0].decode('utf8')) # 3. Get RID Set res = self.samdb.search(base=self.server_ref_dn, scope=ldb.SCOPE_BASE, attrs=['rIDSetReferences']) if "rIDSetReferences" in res[0]: - self.rid_set_dn = ldb.Dn(self.samdb, res[0]['rIDSetReferences'][0]) + self.rid_set_dn = ldb.Dn(self.samdb, res[0]['rIDSetReferences'][0].decode('utf8')) else: self.rid_set_dn = None @@ -2483,7 +2483,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) error_count += 1 if not self.confirm('Change dsServiceName to GUID form?'): return error_count - res = self.samdb.search(base=ldb.Dn(self.samdb, obj['dsServiceName'][0]), + res = self.samdb.search(base=ldb.Dn(self.samdb, obj['dsServiceName'][0].decode('utf8')), scope=ldb.SCOPE_BASE, attrs=['objectGUID']) guid_str = str(ndr_unpack(misc.GUID, res[0]['objectGUID'][0])) m = ldb.Message() diff --git a/python/samba/descriptor.py b/python/samba/descriptor.py index a9c5e1580f0..1e56e5398f8 100644 --- a/python/samba/descriptor.py +++ b/python/samba/descriptor.py @@ -415,7 +415,7 @@ def get_wellknown_sds(samdb): for nc in current[0]["namingContexts"]: dnsforestdn = ldb.Dn(samdb, "DC=ForestDnsZones,%s" % (str(samdb.get_root_basedn()))) - if ldb.Dn(samdb, nc) == dnsforestdn: + if ldb.Dn(samdb, nc.decode('utf8')) == dnsforestdn: c = (ldb.Dn(samdb, "%s" % str(dnsforestdn)), get_dns_partition_descriptor) subcontainers.append(c) c = (ldb.Dn(samdb, "CN=Infrastructure,%s" % str(dnsforestdn)), @@ -430,7 +430,7 @@ def get_wellknown_sds(samdb): continue dnsdomaindn = ldb.Dn(samdb, "DC=DomainDnsZones,%s" % (str(samdb.domain_dn()))) - if ldb.Dn(samdb, nc) == dnsdomaindn: + if ldb.Dn(samdb, nc.decode('utf8')) == dnsdomaindn: c = (ldb.Dn(samdb, "%s" % str(dnsdomaindn)), get_dns_partition_descriptor) subcontainers.append(c) c = (ldb.Dn(samdb, "CN=Infrastructure,%s" % str(dnsdomaindn)), diff --git a/python/samba/join.py b/python/samba/join.py index b5cab7e7cb3..b35eb78e1c6 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -388,7 +388,7 @@ class dc_join(object): if not 'fSMORoleOwner' in res[0]: raise DCJoinException("Can't find naming master on partition DN %s in %s" % (ctx.partition_dn, ctx.samdb.url)) try: - master_guid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['fSMORoleOwner'][0]).get_extended_component('GUID'))) + master_guid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['fSMORoleOwner'][0].decode('utf8')).get_extended_component('GUID'))) except KeyError: raise DCJoinException("Can't find GUID in naming master on partition DN %s" % res[0]['fSMORoleOwner'][0]) @@ -880,7 +880,7 @@ class dc_join(object): raise DCJoinException("Can't find naming context on partition DN %s in %s" % (ctx.partition_dn, ctx.samdb.url)) try: - ctx.names.domainguid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['ncName'][0]).get_extended_component('GUID'))) + ctx.names.domainguid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['ncName'][0].decode('utf8')).get_extended_component('GUID'))) except KeyError: raise DCJoinException("Can't find GUID in naming master on partition DN %s" % res[0]['ncName'][0]) diff --git a/python/samba/kcc/__init__.py b/python/samba/kcc/__init__.py index 1a962bb03c1..be1c4d82968 100644 --- a/python/samba/kcc/__init__.py +++ b/python/samba/kcc/__init__.py @@ -274,7 +274,7 @@ class KCC(object): scope=ldb.SCOPE_BASE, attrs=["dsServiceName"]) dn = ldb.Dn(self.samdb, - service_name_res[0]["dsServiceName"][0]) + service_name_res[0]["dsServiceName"][0].decode('utf8')) res = self.samdb.search(base=dn, scope=ldb.SCOPE_BASE, attrs=["objectGUID"]) diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py index 41e45592b46..91de5dad563 100644 --- a/python/samba/netcmd/fsmo.py +++ b/python/samba/netcmd/fsmo.py @@ -47,7 +47,7 @@ def get_fsmo_roleowner(samdb, roledn, role): raise if 'fSMORoleOwner' in res[0]: - master_owner = (ldb.Dn(samdb, res[0]["fSMORoleOwner"][0])) + master_owner = (ldb.Dn(samdb, res[0]["fSMORoleOwner"][0].decode('utf8'))) else: master_owner = None @@ -72,9 +72,9 @@ def transfer_dns_role(outf, sambaopts, credopts, role, samdb): if 'fSMORoleOwner' in res[0]: try: master_guid = str(misc.GUID(ldb.Dn(samdb, - res[0]['fSMORoleOwner'][0]) + res[0]['fSMORoleOwner'][0].decode('utf8')) .get_extended_component('GUID'))) - master_owner = str(ldb.Dn(samdb, res[0]['fSMORoleOwner'][0])) + master_owner = str(ldb.Dn(samdb, res[0]['fSMORoleOwner'][0].decode('utf8'))) except LdbError as e3: (num, msg) = e3.args raise CommandError("No GUID found in naming master DN %s : %s \n" % diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py index 1709e75184e..43ccb0f8766 100644 --- a/python/samba/provision/__init__.py +++ b/python/samba/provision/__init__.py @@ -220,10 +220,10 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, names.configdn = current[0]["configurationNamingContext"][0] names.schemadn = current[0]["schemaNamingContext"][0] if not (ldb.Dn(samdb, basedn) == (ldb.Dn(samdb, - current[0]["defaultNamingContext"][0]))): + current[0]["defaultNamingContext"][0].decode('utf8')))): raise ProvisioningError(("basedn in %s (%s) and from %s (%s)" "is not the same ..." % (paths.samdb, - str(current[0]["defaultNamingContext"][0]), + str(current[0]["defaultNamingContext"][0].decode('utf8')), paths.smbconf, basedn))) names.domaindn=current[0]["defaultNamingContext"][0] @@ -1920,7 +1920,7 @@ def provision_fill(samdb, secrets_ldb, logger, names, paths, msg = ldb.Message(ldb.Dn(samdb, samdb.searchone("distinguishedName", expression="samAccountName=%s$" % names.netbiosname, - scope=ldb.SCOPE_SUBTREE))) + scope=ldb.SCOPE_SUBTREE).decode('utf8'))) msg["msDS-SupportedEncryptionTypes"] = ldb.MessageElement( elements=kerberos_enctypes, flags=ldb.FLAG_MOD_REPLACE, name="msDS-SupportedEncryptionTypes") diff --git a/python/samba/remove_dc.py b/python/samba/remove_dc.py index 6b86a554efa..b9726f5b84f 100644 --- a/python/samba/remove_dc.py +++ b/python/samba/remove_dc.py @@ -230,7 +230,7 @@ def offline_remove_server(samdb, logger, dc_name = str(msgs[0]["cn"][0]) try: - computer_dn = ldb.Dn(samdb, msgs[0]["serverReference"][0]) + computer_dn = ldb.Dn(samdb, msgs[0]["serverReference"][0].decode('utf8')) except KeyError: computer_dn = None @@ -295,7 +295,7 @@ def offline_remove_ntds_dc(samdb, res = samdb.search("", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"]) assert len(res) == 1 - my_serviceName = ldb.Dn(samdb, res[0]["dsServiceName"][0]) + my_serviceName = ldb.Dn(samdb, res[0]["dsServiceName"][0].decode('utf8')) server_dn = ntds_dn.parent() if my_serviceName == ntds_dn: diff --git a/python/samba/tests/kcc/ldif_import_export.py b/python/samba/tests/kcc/ldif_import_export.py index 6fb3ecd0c37..5ea748ff3f0 100644 --- a/python/samba/tests/kcc/ldif_import_export.py +++ b/python/samba/tests/kcc/ldif_import_export.py @@ -104,7 +104,7 @@ class LdifImportExportTests(samba.tests.TestCaseInTempDir): scope=ldb.SCOPE_BASE, attrs=["dsServiceName"]) dn = ldb.Dn(samdb, - service_name_res[0]["dsServiceName"][0]) + service_name_res[0]["dsServiceName"][0].decode('utf8')) self.assertEqual(dn, ldb.Dn(samdb, "CN=NTDS Settings," + dsa)) self.remove_files(dburl) @@ -128,7 +128,7 @@ class LdifImportExportTests(samba.tests.TestCaseInTempDir): scope=ldb.SCOPE_BASE, attrs=["dsServiceName"]) dn = ldb.Dn(samdb, - service_name_res[0]["dsServiceName"][0]) + service_name_res[0]["dsServiceName"][0].decode('utf8')) self.assertEqual(dn, ldb.Dn(samdb, "CN=NTDS Settings," + dsa)) self.remove_files(dburl) diff --git a/source4/dsdb/tests/python/rodc_rwdc.py b/source4/dsdb/tests/python/rodc_rwdc.py index 1e84369f34f..2f4400e3e16 100644 --- a/source4/dsdb/tests/python/rodc_rwdc.py +++ b/source4/dsdb/tests/python/rodc_rwdc.py @@ -270,7 +270,7 @@ class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase): scope=ldb.SCOPE_BASE, attrs=['msDS-RevealOnDemandGroup']) - group = res[0]['msDS-RevealOnDemandGroup'][0] + group = res[0]['msDS-RevealOnDemandGroup'][0].decode('utf8') m = ldb.Message() m.dn = ldb.Dn(self.rwdc_db, group) @@ -314,7 +314,7 @@ class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase): scope=ldb.SCOPE_BASE, attrs=['msDS-RevealOnDemandGroup']) - group = res[0]['msDS-RevealOnDemandGroup'][0] + group = res[0]['msDS-RevealOnDemandGroup'][0].decode('utf8') m = ldb.Message() m.dn = ldb.Dn(self.rwdc_db, group) @@ -1121,7 +1121,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase): scope=ldb.SCOPE_BASE, attrs=['msDS-RevealOnDemandGroup']) - group = res[0]['msDS-RevealOnDemandGroup'][0] + group = res[0]['msDS-RevealOnDemandGroup'][0].decode('utf8') user_dn, username, password = self._new_user() creds1 = make_creds(username, password) diff --git a/source4/dsdb/tests/python/token_group.py b/source4/dsdb/tests/python/token_group.py index 8c3441e8af9..ccc58b62fbb 100755 --- a/source4/dsdb/tests/python/token_group.py +++ b/source4/dsdb/tests/python/token_group.py @@ -418,7 +418,7 @@ class DynamicTokenTest(samba.tests.TestCase): if "memberOf" in obj: for dn in obj["memberOf"]: first = obj.dn.get_casefold() - second = ldb.Dn(self.admin_ldb, dn).get_casefold() + second = ldb.Dn(self.admin_ldb, dn.decode('utf8')).get_casefold() aSet.add((first, second)) aSetR.add((second, first)) vSet.add(first) @@ -476,7 +476,7 @@ class DynamicTokenTest(samba.tests.TestCase): if "memberOf" in obj: for dn in obj["memberOf"]: first = obj.dn.get_casefold() - second = ldb.Dn(self.admin_ldb, dn).get_casefold() + second = ldb.Dn(self.admin_ldb, dn.decode('utf8')).get_casefold() aSet.add((first, second)) aSetR.add((second, first)) vSet.add(first) diff --git a/source4/torture/drs/python/getnc_exop.py b/source4/torture/drs/python/getnc_exop.py index d92a535932b..e29e346b3eb 100644 --- a/source4/torture/drs/python/getnc_exop.py +++ b/source4/torture/drs/python/getnc_exop.py @@ -110,11 +110,11 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): "server_dn": self.ldb_dc2.get_serverName()} msgs = self.ldb_dc1.search(scope=ldb.SCOPE_BASE, base=fsmo_info_1["server_dn"], attrs=["serverReference"]) - fsmo_info_1["server_acct_dn"] = ldb.Dn(self.ldb_dc1, msgs[0]["serverReference"][0]) + fsmo_info_1["server_acct_dn"] = ldb.Dn(self.ldb_dc1, msgs[0]["serverReference"][0].decode('utf8')) fsmo_info_1["rid_set_dn"] = ldb.Dn(self.ldb_dc1, "CN=RID Set") + fsmo_info_1["server_acct_dn"] msgs = self.ldb_dc2.search(scope=ldb.SCOPE_BASE, base=fsmo_info_2["server_dn"], attrs=["serverReference"]) - fsmo_info_2["server_acct_dn"] = ldb.Dn(self.ldb_dc2, msgs[0]["serverReference"][0]) + fsmo_info_2["server_acct_dn"] = ldb.Dn(self.ldb_dc2, msgs[0]["serverReference"][0].decode('utf8')) fsmo_info_2["rid_set_dn"] = ldb.Dn(self.ldb_dc2, "CN=RID Set") + fsmo_info_2["server_acct_dn"] # determine the owner dc diff --git a/source4/torture/drs/python/ridalloc_exop.py b/source4/torture/drs/python/ridalloc_exop.py index 7604e1e2cab..f4c404111ce 100644 --- a/source4/torture/drs/python/ridalloc_exop.py +++ b/source4/torture/drs/python/ridalloc_exop.py @@ -73,11 +73,11 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): "server_dn": self.ldb_dc2.get_serverName()} msgs = self.ldb_dc1.search(scope=ldb.SCOPE_BASE, base=fsmo_info_1["server_dn"], attrs=["serverReference"]) - fsmo_info_1["server_acct_dn"] = ldb.Dn(self.ldb_dc1, msgs[0]["serverReference"][0]) + fsmo_info_1["server_acct_dn"] = ldb.Dn(self.ldb_dc1, msgs[0]["serverReference"][0].decode('utf8')) fsmo_info_1["rid_set_dn"] = ldb.Dn(self.ldb_dc1, "CN=RID Set") + fsmo_info_1["server_acct_dn"] msgs = self.ldb_dc2.search(scope=ldb.SCOPE_BASE, base=fsmo_info_2["server_dn"], attrs=["serverReference"]) - fsmo_info_2["server_acct_dn"] = ldb.Dn(self.ldb_dc2, msgs[0]["serverReference"][0]) + fsmo_info_2["server_acct_dn"] = ldb.Dn(self.ldb_dc2, msgs[0]["serverReference"][0].decode('utf8')) fsmo_info_2["rid_set_dn"] = ldb.Dn(self.ldb_dc2, "CN=RID Set") + fsmo_info_2["server_acct_dn"] # determine the owner dc @@ -282,7 +282,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # Assert that no RID Set has been set res = new_ldb.search(base=server_ref_dn, @@ -356,7 +356,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # Assert that no RID Set has been set res = new_ldb.search(base=server_ref_dn, @@ -407,7 +407,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # Assert that no RID Set has been set res = new_ldb.search(base=server_ref_dn, @@ -457,7 +457,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # Assert that no RID Set has been set res = new_ldb.search(base=server_ref_dn, @@ -500,7 +500,7 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # 3. Assert we get the RID Set res = new_ldb.search(base=server_ref_dn, @@ -532,14 +532,14 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # 3. Assert we get the RID Set res = new_ldb.search(base=server_ref_dn, scope=ldb.SCOPE_BASE, attrs=['rIDSetReferences']) self.assertTrue("rIDSetReferences" in res[0]) - rid_set_dn = ldb.Dn(new_ldb, res[0]["rIDSetReferences"][0]) + rid_set_dn = ldb.Dn(new_ldb, res[0]["rIDSetReferences"][0].decode('utf8')) # 4. Add a new user (triggers RID set work) new_ldb.newuser("ridalloctestuser", "P@ssword!") @@ -610,15 +610,14 @@ class DrsReplicaSyncTestCase(drs_base.DrsBaseTestCase): res = new_ldb.search(base=ldb.Dn(new_ldb, new_ldb.get_serverName()), scope=ldb.SCOPE_BASE, attrs=["serverReference"]) # 2. Get server reference - server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0]) + server_ref_dn = ldb.Dn(new_ldb, res[0]['serverReference'][0].decode('utf8')) # 3. Assert we get the RID Set res = new_ldb.search(base=server_ref_dn, scope=ldb.SCOPE_BASE, attrs=['rIDSetReferences']) self.assertTrue("rIDSetReferences" in res[0]) - rid_set_dn = ldb.Dn(new_ldb, res[0]["rIDSetReferences"][0]) - + rid_set_dn = ldb.Dn(new_ldb, res[0]["rIDSetReferences"][0].decode('utf8')) # 4. Seize the RID Manager role (result, out, err) = self.runsubcmd("fsmo", "seize", "--role", "rid", "-H", ldb_url, "-s", smbconf, "--force") self.assertCmdSuccess(result, out, err) |