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

Commit

Permalink
Fixed offered SASL mechanism check
Browse files Browse the repository at this point in the history
  • Loading branch information
smokku committed Jul 1, 2017
1 parent e5c5518 commit 8416ae5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions c2s/main.c
Expand Up @@ -562,6 +562,8 @@ static int _c2s_sx_sasl_callback(int cb, void *arg, void **res, sx_t s, void *cb
mechbuf[sizeof(mechbuf)-1]='\0';
for(i = 0; mechbuf[i]; i++) mechbuf[i] = tolower(mechbuf[i]);

log_debug(ZONE, "sx sasl callback: check mech (mech=%s)", mechbuf);

/* get host for request */
host = xhash_get(c2s->hosts, s->req_to);
if(host == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion sx/sasl.c
Expand Up @@ -332,7 +332,7 @@ static void _sx_sasl_client_process(sx_t s, sx_plugin_t p, Gsasl_session *sd, co
if(mech != NULL) {
_sx_debug(ZONE, "auth request from client (mechanism=%s)", mech);

if(!gsasl_server_support_p(ctx->gsasl_ctx, mech)) {
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) {
_sx_debug(ZONE, "client requested mechanism (%s) that we didn't offer", mech);
_sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_INVALID_MECHANISM, NULL), 0);
return;
Expand Down

0 comments on commit 8416ae5

Please sign in to comment.