]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:netcmd: Decode return value of find_netbios() from bytes into string
authorAndreas Schneider <asn@samba.org>
Fri, 10 Mar 2023 08:08:48 +0000 (09:08 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 14 Mar 2023 06:16:30 +0000 (06:16 +0000)
ERROR(<class 'TypeError'>): uncaught exception - replace() argument 1 must be
str, not bytes
  File "bin/python/samba/netcmd/__init__.py", line 230, in _run
    return self.run(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bin/python/samba/netcmd/ldapcmp.py", line 966, in run
    if b1.diff(b2):
       ^^^^^^^^^^^
  File "bin/python/samba/netcmd/ldapcmp.py", line 790, in diff
    if object1 == object2:
       ^^^^^^^^^^^^^^^^^^
  File "bin/python/samba/netcmd/ldapcmp.py", line 557, in __eq__
    return self.cmp_attrs(other)
           ^^^^^^^^^^^^^^^^^^^^^
  File "bin/python/samba/netcmd/ldapcmp.py", line 656, in cmp_attrs
    p = [self.fix_domain_netbios(j) for j in m]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bin/python/samba/netcmd/ldapcmp.py", line 656, in <listcomp>
    p = [self.fix_domain_netbios(j) for j in m]
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bin/python/samba/netcmd/ldapcmp.py", line 542, in fix_domain_netbios
    res = res.replace(self.con.domain_netbios.lower(), self.con.domain_netbios.upper())
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

BUGS: https://bugzilla.samba.org/show_bug.cgi?id=15330

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/netcmd/ldapcmp.py

index fb49cbe1ae546efe8e7df2963928a705d8f11928..ff26e96332d0e03e3bc41db697c541ff3aacae08 100644 (file)
@@ -121,7 +121,7 @@ class LDAPBase(object):
 
         for x in res:
             if "nETBIOSName" in x:
-                return x["nETBIOSName"][0]
+                return x["nETBIOSName"][0].decode()
 
     def object_exists(self, object_dn):
         res = None