From 471163e82e1651f9051622be349a5e868db420bd Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 10 Aug 2018 18:07:11 +0100 Subject: python/samba: changes needed for samba.tests.samba_tool.visualize PY2/PY3 Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett --- python/samba/kcc/kcc_utils.py | 2 +- python/samba/netcmd/visualize.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/samba/kcc/kcc_utils.py b/python/samba/kcc/kcc_utils.py index c099140c936..9959637836f 100644 --- a/python/samba/kcc/kcc_utils.py +++ b/python/samba/kcc/kcc_utils.py @@ -994,7 +994,7 @@ class NTDSConnection(object): self.schedule = ndr_unpack(drsblobs.schedule, msg["schedule"][0]) if "whenCreated" in msg: - self.whenCreated = ldb.string_to_time(msg["whenCreated"][0]) + self.whenCreated = ldb.string_to_time(str(msg["whenCreated"][0])) if "fromServer" in msg: dsdn = dsdb_Dn(samdb, msg["fromServer"][0].decode('utf8')) diff --git a/python/samba/netcmd/visualize.py b/python/samba/netcmd/visualize.py index 93c0929326e..8292802326b 100644 --- a/python/samba/netcmd/visualize.py +++ b/python/samba/netcmd/visualize.py @@ -275,7 +275,7 @@ class cmd_reps(GraphCommand): res = local_kcc.samdb.search(dsa_dn, scope=SCOPE_BASE, attrs=["dNSHostName"]) - dns_name = res[0]["dNSHostName"][0] + dns_name = str(res[0]["dNSHostName"][0]) print("Attempting to contact ldap://%s (%s)" % (dns_name, dsa_dn), file=sys.stderr) @@ -508,7 +508,7 @@ class cmd_ntdsconn(GraphCommand): for msg in res: msgdn = str(msg.dn) dest_dn = msgdn[msgdn.index(',') + 1:] - attested_edges.append((msg['fromServer'][0], + attested_edges.append((str(msg['fromServer'][0]), dest_dn, ntds_dn)) if importldif and H == self._tmp_fn_to_delete: @@ -694,7 +694,7 @@ class cmd_uptodateness(GraphCommand): expression=("(&(invocationId=%s)" "(objectClass=nTDSDSA))" % inv_id), attrs=["distinguishedName", "invocationId"]) - settings_dn = res[0]["distinguishedName"][0] + settings_dn = str(res[0]["distinguishedName"][0]) prefix, dsa_dn = settings_dn.split(',', 1) if prefix != 'CN=NTDS Settings': raise CommandError("Expected NTDS Settings DN, got %s" % -- cgit v1.2.1