python/samba: misc use of str for ldb.bytes
authorNoel Power <noel.power@suse.com>
Thu, 23 Aug 2018 16:59:12 +0000 (17:59 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 23 Oct 2018 03:50:27 +0000 (05:50 +0200)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/dbchecker.py
python/samba/netcmd/ldapcmp.py

index 8b621dc8221cee273f84816b191641d660c613d1..e823da6e190609f2e51d8d96cd368005185d17a6 100644 (file)
@@ -1223,7 +1223,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                 dsdb_dn.prefix = "B:8:%08X:" % int(res[0]['instanceType'][0])
                 dsdb_dn.binary = "%08X" % int(res[0]['instanceType'][0])
 
-                if str(dsdb_dn) != val:
+                if str(dsdb_dn) != str(val):
                     error_count += 1
                     self.err_incorrect_binary_dn(obj.dn, attrname, val, dsdb_dn, "incorrect instanceType part of Binary DN")
                     continue
@@ -1841,7 +1841,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         if "description" not in obj:
             self.report("ERROR: description not present on Deleted Objects container %s" % obj.dn)
             faulty = True
-        if "showInAdvancedViewOnly" not in obj or obj['showInAdvancedViewOnly'][0].upper() == 'FALSE':
+        if "showInAdvancedViewOnly" not in obj or str(obj['showInAdvancedViewOnly'][0]).upper() == 'FALSE':
             self.report("ERROR: showInAdvancedViewOnly not present on Deleted Objects container %s" % obj.dn)
             faulty = True
         if "objectCategory" not in obj:
@@ -1857,11 +1857,11 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
             self.report("ERROR: isDeleted not set on Deleted Objects container %s" % obj.dn)
             faulty = True
         if "objectClass" not in obj or (len(obj['objectClass']) != 2 or
-                                        obj['objectClass'][0] != 'top' or
-                                        obj['objectClass'][1] != 'container'):
+                                        str(obj['objectClass'][0]) != 'top' or
+                                        str(obj['objectClass'][1]) != 'container'):
             self.report("ERROR: objectClass incorrectly set on Deleted Objects container %s" % obj.dn)
             faulty = True
-        if "systemFlags" not in obj or obj['systemFlags'][0] != '-1946157056':
+        if "systemFlags" not in obj or str(obj['systemFlags'][0]) != '-1946157056':
             self.report("ERROR: systemFlags incorrectly set on Deleted Objects container %s" % obj.dn)
             faulty = True
         return faulty
index 231aaa1cb95b6165e23ff84301f3885cbe2e46f8..63236a4c7616ee0d780f7c1bfc8a4ed5eeca4b38 100644 (file)
@@ -108,7 +108,7 @@ class LDAPBase(object):
         assert len(res) > 0
         srv = []
         for x in res:
-            srv.append(x["cn"][0])
+            srv.append(str(x["cn"][0]))
         return srv
 
     def find_netbios(self):
@@ -259,7 +259,7 @@ class LDAPBase(object):
                               expression="(objectSid=*)", scope=SCOPE_SUBTREE, attrs=["objectSid", "sAMAccountName"])
         for item in res:
             try:
-                self.sid_map["%s" % ndr_unpack(security.dom_sid, item["objectSid"][0])] = item["sAMAccountName"][0]
+                self.sid_map["%s" % ndr_unpack(security.dom_sid, item["objectSid"][0])] = str(item["sAMAccountName"][0])
             except KeyError:
                 pass