auth/credentials: py2/py3 credential key needs to return bytes
authorNoel Power <noel.power@suse.com>
Wed, 9 May 2018 15:09:00 +0000 (16:09 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Sep 2018 21:27:12 +0000 (23:27 +0200)
new_client_authenticator returns a dictionary. The key
'credential' needs to return bytes in Python3, without this
change the the code will attempt to convert the binary data to
a string (resulting sometimes in decode errors).

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/pycredentials.c

index c626e3fa8a07c9e734e7542aedafb6fccc9b3f03..56174fefbb4f9002ba0255c32e9b24999377ab43 100644 (file)
@@ -659,7 +659,7 @@ static PyObject *py_creds_new_client_authenticator(PyObject *self,
        netlogon_creds_client_authenticator(
                nc,
                &auth);
-       ret = Py_BuildValue("{ss#si}",
+       ret = Py_BuildValue("{s"PYARG_BYTES_LEN"si}",
                            "credential",
                            (const char *) &auth.cred, sizeof(auth.cred),
                            "timestamp", auth.timestamp);