python/samba: changes needed for samba.tests.samba_tool.visualize PY2/PY3
authorNoel Power <noel.power@suse.com>
Fri, 10 Aug 2018 17:07:11 +0000 (18:07 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 3 Sep 2018 01:22:21 +0000 (03:22 +0200)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/kcc/kcc_utils.py
python/samba/netcmd/visualize.py

index c099140..9959637 100644 (file)
@@ -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'))
index 93c0929..8292802 100644 (file)
@@ -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" %