diff options
author | Christophe Lecointe <christophe.lecointe@tuta.io> | 2018-01-24 20:26:22 +0100 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2018-01-24 11:26:22 -0800 |
commit | 351f418ba5b62c28c8cff5ea7dcca8e37cadcf8e (patch) | |
tree | 49ba8b81d015d9106fa9ed39860dfc30414f6f80 | |
parent | bfa6e2044ad7ecef8ab042d43e2c4d47467d3949 (diff) | |
download | kafka-python-351f418ba5b62c28c8cff5ea7dcca8e37cadcf8e.tar.gz |
Fix for Python 3 byte string handling in SASL auth (#1353)
-rw-r--r-- | AUTHORS.md | 2 | ||||
-rw-r--r-- | kafka/conn.py | 4 |
2 files changed, 4 insertions, 2 deletions
@@ -45,5 +45,7 @@ * Lou Marvin Caraig, [@se7entyse7en](https://github.com/se7entyse7en) * waliaashish85, [@waliaashish85](https://github.com/waliaashish85) * Mark Roberts, [@wizzat](https://github.com/wizzat) +* Christophe Lecointe [@christophelec](https://github.com/christophelec) +* Mohamed Helmi Hichri [@hellich](https://github.com/hellich) Thanks to all who have contributed! diff --git a/kafka/conn.py b/kafka/conn.py index f30d987..5ff27d5 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -566,9 +566,9 @@ class BrokerConnection(object): # Kafka currently doesn't support integrity or confidentiality security layers, so we # simply set QoP to 'auth' only (first octet). We reuse the max message size proposed # by the server - msg = Int8.encode(SASL_QOP_AUTH & Int8.decode(io.BytesIO(msg[0]))) + msg[1:] + msg = Int8.encode(SASL_QOP_AUTH & Int8.decode(io.BytesIO(msg[0:1]))) + msg[1:] # add authorization identity to the response, GSS-wrap and send it - msg = client_ctx.wrap(msg + auth_id, False).message + msg = client_ctx.wrap(msg + auth_id.encode(), False).message size = Int32.encode(len(msg)) self._send_bytes_blocking(size + msg) |