Skip to content
This repository was archived by the owner on Feb 12, 2019. It is now read-only.

Commit 8416ae5

Browse files
committed
Fixed offered SASL mechanism check
1 parent e5c5518 commit 8416ae5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: c2s/main.c

+2
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,8 @@ static int _c2s_sx_sasl_callback(int cb, void *arg, void **res, sx_t s, void *cb
562562
mechbuf[sizeof(mechbuf)-1]='\0';
563563
for(i = 0; mechbuf[i]; i++) mechbuf[i] = tolower(mechbuf[i]);
564564

565+
log_debug(ZONE, "sx sasl callback: check mech (mech=%s)", mechbuf);
566+
565567
/* get host for request */
566568
host = xhash_get(c2s->hosts, s->req_to);
567569
if(host == NULL) {

Diff for: sx/sasl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, co
332332
if(mech != NULL) {
333333
_sx_debug(ZONE, "auth request from client (mechanism=%s)", mech);
334334

335-
if(!gsasl_server_support_p(ctx->gsasl_ctx, mech)) {
335+
if(!gsasl_server_support_p(ctx->gsasl_ctx, mech) || (ctx->cb)(sx_sasl_cb_CHECK_MECH, (void*)mech, NULL, s, ctx->cbarg) != sx_sasl_ret_OK) {
336336
_sx_debug(ZONE, "client requested mechanism (%s) that we didn't offer", mech);
337337
_sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_INVALID_MECHANISM, NULL), 0);
338338
return;

0 commit comments

Comments
 (0)