Decode bytes in GSSAPI handling, as expected by the kerberos module API.

This commit is contained in:
Jelmer Vernooij 2018-10-30 22:29:20 +00:00
parent 570e653ac2
commit 2d228bdb56
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8

View file

@ -516,13 +516,13 @@ else:
def setup(self, name): def setup(self, name):
authzid = self.credentials['authzid'] authzid = self.credentials['authzid']
if not authzid: if not authzid:
authzid = 'xmpp@%s' % self.credentials['service-name'] authzid = 'xmpp@' + self.credentials['service-name'].decode()
_, self.gss = kerberos.authGSSClientInit(authzid) _, self.gss = kerberos.authGSSClientInit(authzid)
self.step = 0 self.step = 0
def process(self, challenge=b''): def process(self, challenge=b''):
b64_challenge = b64encode(challenge) b64_challenge = b64encode(challenge).decode('ascii')
try: try:
if self.step == 0: if self.step == 0:
result = kerberos.authGSSClientStep(self.gss, b64_challenge) result = kerberos.authGSSClientStep(self.gss, b64_challenge)
@ -536,7 +536,7 @@ else:
kerberos.authGSSClientUnwrap(self.gss, b64_challenge) kerberos.authGSSClientUnwrap(self.gss, b64_challenge)
resp = kerberos.authGSSClientResponse(self.gss) resp = kerberos.authGSSClientResponse(self.gss)
kerberos.authGSSClientWrap(self.gss, resp, username) kerberos.authGSSClientWrap(self.gss, resp, username.decode())
resp = kerberos.authGSSClientResponse(self.gss) resp = kerberos.authGSSClientResponse(self.gss)
except kerberos.GSSError as e: except kerberos.GSSError as e: