mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Correctly process errors from new cyrsasl API
This commit is contained in:
parent
666608544b
commit
5ef60bf594
@ -719,17 +719,22 @@ wait_for_feature_request(#sasl_auth{mechanism = Mech,
|
||||
fsm_next_state(wait_for_sasl_response,
|
||||
StateData#state{sasl_state = NewSASLState});
|
||||
{error, Error, Username} ->
|
||||
?INFO_MSG("(~w) Failed authentication for ~s@~s from ~s",
|
||||
{Reason, ErrTxt} = cyrsasl:format_error(Mech, Error),
|
||||
?INFO_MSG("(~w) Failed authentication for ~s@~s from ~s: ~s",
|
||||
[StateData#state.socket,
|
||||
Username, StateData#state.server,
|
||||
ejabberd_config:may_hide_data(jlib:ip_to_list(StateData#state.ip))]),
|
||||
ejabberd_config:may_hide_data(jlib:ip_to_list(StateData#state.ip)),
|
||||
ErrTxt]),
|
||||
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
|
||||
[false, Username, StateData#state.server,
|
||||
StateData#state.ip]),
|
||||
send_element(StateData, #sasl_failure{reason = Error}),
|
||||
send_element(StateData, #sasl_failure{reason = Reason,
|
||||
text = xmpp:mk_text(ErrTxt)}),
|
||||
fsm_next_state(wait_for_feature_request, StateData);
|
||||
{error, Error} ->
|
||||
send_element(StateData, #sasl_failure{reason = Error}),
|
||||
{Reason, ErrTxt} = cyrsasl:format_error(Mech, Error),
|
||||
send_element(StateData, #sasl_failure{reason = Reason,
|
||||
text = xmpp:mk_text(ErrTxt)}),
|
||||
fsm_next_state(wait_for_feature_request, StateData)
|
||||
end;
|
||||
wait_for_feature_request(#starttls{},
|
||||
@ -839,17 +844,22 @@ wait_for_sasl_response(#sasl_response{text = ClientIn}, StateData) ->
|
||||
fsm_next_state(wait_for_sasl_response,
|
||||
StateData#state{sasl_state = NewSASLState});
|
||||
{error, Error, Username} ->
|
||||
?INFO_MSG("(~w) Failed authentication for ~s@~s from ~s",
|
||||
{Reason, ErrTxt} = cyrsasl:format_error(StateData#state.sasl_state, Error),
|
||||
?INFO_MSG("(~w) Failed authentication for ~s@~s from ~s: ~s",
|
||||
[StateData#state.socket,
|
||||
Username, StateData#state.server,
|
||||
ejabberd_config:may_hide_data(jlib:ip_to_list(StateData#state.ip))]),
|
||||
ejabberd_config:may_hide_data(jlib:ip_to_list(StateData#state.ip)),
|
||||
ErrTxt]),
|
||||
ejabberd_hooks:run(c2s_auth_result, StateData#state.server,
|
||||
[false, Username, StateData#state.server,
|
||||
StateData#state.ip]),
|
||||
send_element(StateData, #sasl_failure{reason = Error}),
|
||||
send_element(StateData, #sasl_failure{reason = Reason,
|
||||
text = xmpp:mk_text(ErrTxt)}),
|
||||
fsm_next_state(wait_for_feature_request, StateData);
|
||||
{error, Error} ->
|
||||
send_element(StateData, #sasl_failure{reason = Error}),
|
||||
{Reason, ErrTxt} = cyrsasl:format_error(StateData#state.sasl_state, Error),
|
||||
send_element(StateData, #sasl_failure{reason = Reason,
|
||||
text = xmpp:mk_text(ErrTxt)}),
|
||||
fsm_next_state(wait_for_feature_request, StateData)
|
||||
end;
|
||||
wait_for_sasl_response(timeout, StateData) ->
|
||||
|
Loading…
Reference in New Issue
Block a user