s4/scripting/bin: PY3 convert servicePrincipalName attr to string
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 30 Oct 2018 12:51:54 +0000 (12:51 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 14 Nov 2018 04:07:17 +0000 (05:07 +0100)
res[0]["servicePrincipalName"] is an instance of ldb.bytes in PY3
If we wish to get the string value we need to call the custom
str function which attempts to decode the bytes to 'utf8'

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed by: Noel Power <npower@samba.org>

source4/scripting/bin/samba_spnupdate

index 69de3819751da8fc2ec87318ecf6bc3ed5cdb72a..a7ec0b9696391fdec4f54305b8d5a42e1c3c90aa 100755 (executable)
@@ -165,7 +165,7 @@ machine_dn = res[0]["dn"]
 old_spns = []
 if "servicePrincipalName" in res[0]:
     for s in res[0]["servicePrincipalName"]:
-        old_spns.append(s)
+        old_spns.append(str(s))
 
 if opts.verbose:
     print("Existing SPNs: %s" % old_spns)