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
1 changed files with 15 additions and 3 deletions

View File

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