25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Make sure IQ result is correctly routed on account removal

Thanks to Philipp Hörist for spotting this
This commit is contained in:
Evgeny Khramtsov 2019-11-24 15:43:38 +03:00
parent 33a16090d3
commit 650bdae5d9

View File

@ -131,12 +131,24 @@ process_iq(#iq{type = set, lang = Lang, to = To, from = From,
if is_binary(User) ->
case From of
#jid{user = User, lserver = Server} ->
ResIQ = xmpp:make_iq_result(IQ),
ejabberd_router:route(ResIQ),
ejabberd_auth:remove_user(User, Server),
xmpp:make_iq_result(IQ);
ignore;
_ ->
if is_binary(Password) ->
ejabberd_auth:remove_user(User, Server, Password),
xmpp:make_iq_result(IQ);
case ejabberd_auth:check_password(
User, <<"">>, Server, Password) of
true ->
ResIQ = xmpp:make_iq_result(IQ),
ejabberd_router:route(ResIQ),
ejabberd_auth:remove_user(User, Server),
ignore;
false ->
Txt = ?T("Incorrect password"),
xmpp:make_error(
IQ, xmpp:err_forbidden(Txt, Lang))
end;
true ->
Txt = ?T("No 'password' found in this query"),
xmpp:make_error(IQ, xmpp:err_bad_request(Txt, Lang))