diff options
author | Noel Power <noel.power@suse.com> | 2018-04-25 18:28:30 +0100 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2018-04-30 15:43:19 +0200 |
commit | 13280d3db9fdbbd87c6ed2faa69b24bc7660674d (patch) | |
tree | f04fb4f98163f7a90f20e5f50effd70206e01459 /python | |
parent | cbd6786c0471782024750b85b6f4fbf42977c81b (diff) | |
download | samba-13280d3db9fdbbd87c6ed2faa69b24bc7660674d.tar.gz |
python/samba: bulk conversion of caller to dsdb_Dn 2nd param.
Convert second param to dsdb_Dn to be unicode so py2 & py3 code
will work
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/dbchecker.py | 14 | ||||
-rw-r--r-- | python/samba/kcc/kcc_utils.py | 12 | ||||
-rw-r--r-- | python/samba/kcc/ldif_import_export.py | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py index fb968a56481..bdcbc34e011 100644 --- a/python/samba/dbchecker.py +++ b/python/samba/dbchecker.py @@ -286,7 +286,7 @@ class dbcheck(object): listwko = [] proposed_objectguid = None for o in wko: - dsdb_dn = dsdb_Dn(self.samdb, o, dsdb.DSDB_SYNTAX_BINARY_DN) + dsdb_dn = dsdb_Dn(self.samdb, o.decode('utf8'), dsdb.DSDB_SYNTAX_BINARY_DN) if self.is_deleted_objects_dn(dsdb_dn): self.report("wellKnownObjects had duplicate Deleted Objects value %s" % o) # We really want to put this back in the same spot @@ -917,7 +917,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) controls=["show_deleted:0", "extended_dn:0", "reveal_internals:0"]) syntax_oid = self.samdb_schema.get_syntax_oid_from_lDAPDisplayName(attrname) for val in res[0][attrname]: - dsdb_dn = dsdb_Dn(self.samdb, val, syntax_oid) + dsdb_dn = dsdb_Dn(self.samdb, val.decode('utf8'), syntax_oid) guid2 = dsdb_dn.dn.get_extended_component("GUID") if guid == guid2: return dsdb_dn @@ -943,7 +943,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) self.duplicate_link_cache[duplicate_cache_key] = False for val in obj[forward_attr]: - dsdb_dn = dsdb_Dn(self.samdb, val, forward_syntax) + dsdb_dn = dsdb_Dn(self.samdb, val.decode('utf8'), forward_syntax) # all DNs should have a GUID component guid = dsdb_dn.dn.get_extended_component("GUID") @@ -1178,7 +1178,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) obj[attrname] = ldb.MessageElement(vals, 0, attrname) for val in obj[attrname]: - dsdb_dn = dsdb_Dn(self.samdb, val, syntax_oid) + dsdb_dn = dsdb_Dn(self.samdb, val.decode('utf8'), syntax_oid) # all DNs should have a GUID component guid = dsdb_dn.dn.get_extended_component("GUID") @@ -1312,7 +1312,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) match_count = 0 if reverse_link_name in res[0]: for v in res[0][reverse_link_name]: - v_dn = dsdb_Dn(self.samdb, v) + v_dn = dsdb_Dn(self.samdb, v.decode('utf8')) v_guid = v_dn.dn.get_extended_component("GUID") v_blob = v_dn.dn.get_extended_component("RMD_FLAGS") v_rmd_flags = 0 @@ -1329,7 +1329,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) # Forward binary multi-valued linked attribute forward_count = 0 for w in obj[attrname]: - w_guid = dsdb_Dn(self.samdb, w).dn.get_extended_component("GUID") + w_guid = dsdb_Dn(self.samdb, w.decode('utf8')).dn.get_extended_component("GUID") if w_guid == guid: forward_count += 1 @@ -1337,7 +1337,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base))) continue expected_count = 0 for v in obj[attrname]: - v_dn = dsdb_Dn(self.samdb, v) + v_dn = dsdb_Dn(self.samdb, v.decode('utf8')) v_guid = v_dn.dn.get_extended_component("GUID") v_blob = v_dn.dn.get_extended_component("RMD_FLAGS") v_rmd_flags = 0 diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index 2118570bbfc..23fbd40e904 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -739,7 +739,7 @@ class DirectoryServiceAgent(object): for value in res[0][k]: # Turn dn into a dsdb_Dn so we can use # its methods to parse a binary DN - dsdn = dsdb_Dn(samdb, value) + dsdn = dsdb_Dn(samdb, value.decode('utf8')) flags = dsdn.get_binary_integer() dnstr = str(dsdn.dn) @@ -986,7 +986,7 @@ class NTDSConnection(object): "for (%s)" % (self.dnstr)) if "transportType" in msg: - dsdn = dsdb_Dn(samdb, msg["transportType"][0]) + dsdn = dsdb_Dn(samdb, msg["transportType"][0].decode('utf8')) self.load_connection_transport(samdb, str(dsdn.dn)) if "schedule" in msg: @@ -996,7 +996,7 @@ class NTDSConnection(object): self.whenCreated = ldb.string_to_time(msg["whenCreated"][0]) if "fromServer" in msg: - dsdn = dsdb_Dn(samdb, msg["fromServer"][0]) + dsdn = dsdb_Dn(samdb, msg["fromServer"][0].decode('utf8')) self.from_dnstr = str(dsdn.dn) assert self.from_dnstr is not None @@ -1363,7 +1363,7 @@ class Partition(NamingContext): continue for value in msg[k]: - dsdn = dsdb_Dn(samdb, value) + dsdn = dsdb_Dn(samdb, value.decode('utf8')) dnstr = str(dsdn.dn) if k == "nCName": @@ -1926,7 +1926,7 @@ class Transport(object): if "bridgeheadServerListBL" in msg: for value in msg["bridgeheadServerListBL"]: - dsdn = dsdb_Dn(samdb, value) + dsdn = dsdb_Dn(samdb, value.decode('utf8')) dnstr = str(dsdn.dn) if dnstr not in self.bridgehead_list: self.bridgehead_list.append(dnstr) @@ -2188,7 +2188,7 @@ class SiteLink(object): if "siteList" in msg: for value in msg["siteList"]: - dsdn = dsdb_Dn(samdb, value) + dsdn = dsdb_Dn(samdb, value.decode('utf8')) guid = misc.GUID(dsdn.dn.get_extended_component('GUID')) if guid not in self.site_list: self.site_list.append(guid) diff --git a/python/samba/kcc/ldif_import_export.py b/python/samba/kcc/ldif_import_export.py index aab39eeb492..86453f1e5c9 100644 --- a/python/samba/kcc/ldif_import_export.py +++ b/python/samba/kcc/ldif_import_export.py @@ -233,7 +233,7 @@ def samdb_to_ldif_file(samdb, dburl, lp, creds, ldif_file): for value in msg[k]: # Some of these have binary DNs so # use dsdb_Dn to split out relevent parts - dsdn = dsdb_Dn(samdb, value) + dsdn = dsdb_Dn(samdb, value.decode('utf8')) dnstr = str(dsdn.dn) if dnstr not in nclist: nclist.append(dnstr) |