Skip to content

Commit 351f418

Browse files
christophelecdpkp
authored andcommitted
Fix for Python 3 byte string handling in SASL auth (dpkp#1353)
1 parent bfa6e20 commit 351f418

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

AUTHORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,7 @@
4545
* Lou Marvin Caraig, [@se7entyse7en](https://github.com/se7entyse7en)
4646
* waliaashish85, [@waliaashish85](https://github.com/waliaashish85)
4747
* Mark Roberts, [@wizzat](https://github.com/wizzat)
48+
* Christophe Lecointe [@christophelec](https://github.com/christophelec)
49+
* Mohamed Helmi Hichri [@hellich](https://github.com/hellich)
4850

4951
Thanks to all who have contributed!

kafka/conn.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ def _try_authenticate_gssapi(self, future):
566566
# Kafka currently doesn't support integrity or confidentiality security layers, so we
567567
# simply set QoP to 'auth' only (first octet). We reuse the max message size proposed
568568
# by the server
569-
msg = Int8.encode(SASL_QOP_AUTH & Int8.decode(io.BytesIO(msg[0]))) + msg[1:]
569+
msg = Int8.encode(SASL_QOP_AUTH & Int8.decode(io.BytesIO(msg[0:1]))) + msg[1:]
570570
# add authorization identity to the response, GSS-wrap and send it
571-
msg = client_ctx.wrap(msg + auth_id, False).message
571+
msg = client_ctx.wrap(msg + auth_id.encode(), False).message
572572
size = Int32.encode(len(msg))
573573
self._send_bytes_blocking(size + msg)
574574

0 commit comments

Comments
 (0)