Skip to content

Commit

Permalink
Properly handle new Kafka-framed SASL GSSAPI frame semantics on Win32…
Browse files Browse the repository at this point in the history
…/SSPI (#2542)
  • Loading branch information
edenhill committed Oct 4, 2019
1 parent c3febe4 commit 3cc2db5
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/rdkafka_sasl_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,31 @@ static int rd_kafka_sasl_win32_recv (struct rd_kafka_transport_s *rktrans,
rd_kafka_sasl_win32_state_t *state = rktrans->rktrans_sasl.state;

if (rktrans->rktrans_sasl.complete) {
if (rd_kafka_sasl_win32_validate_token(
rktrans, buf, size, errstr, errstr_size) == -1) {
rktrans->rktrans_sasl.complete = 0;
return -1;

if (size > 0) {
/* After authentication is done the broker will send
* back its token for us to verify.
* The client responds to the broker which will
* return an empty (size==0) frame that
* completes the authentication handshake.
* With legacy SASL framing the final empty token
* is not sent. */
int r;

r = rd_kafka_sasl_win32_validate_token(
rktrans, buf, size, errstr, errstr_size);

if (r == -1) {
rktrans->rktrans_sasl.complete = 0;
return r;
} else if (rktrans->rktrans_rkb->rkb_features &
RD_KAFKA_FEATURE_SASL_AUTH_REQ) {
/* Kafka-framed handshake requires
* one more back and forth. */
return r;
}

/* Legacy-framed handshake is done here */
}

/* Final ack from broker. */
Expand Down

0 comments on commit 3cc2db5

Please sign in to comment.