Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed offered SASL mechanism check

  • Loading branch information...
smokku committed Jul 1, 2017
1 parent e5c5518 commit 8416ae54ecefa670534f27a31db71d048b9c7f16
Showing with 3 additions and 1 deletion.
  1. +2 −0 c2s/main.c
  2. +1 −1 sx/sasl.c
@@ -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) {
@@ -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;

0 comments on commit 8416ae5

Please sign in to comment.
You can’t perform that action at this time.