25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Fix PIEFXIS export of user when password is scrammed (#2721)

This commit is contained in:
Badlop 2018-12-19 12:33:46 +01:00
parent 590bb0e64a
commit 788d829823

View File

@ -166,15 +166,10 @@ export_users([], _Server, _Fd) ->
export_user(User, Server, Fd) ->
Password = ejabberd_auth:get_password_s(User, Server),
LServer = jid:nameprep(Server),
PasswordFormat = ejabberd_auth:password_format(LServer),
Pass = case Password of
{_,_,_,_} ->
case PasswordFormat of
scram -> format_scram_password(Password);
_ -> <<"">>
end;
_ -> Password
end,
Pass = case ejabberd_auth:password_format(LServer) of
scram -> format_scram_password(Password);
_ -> Password
end,
Els = get_offline(User, Server) ++
get_vcard(User, Server) ++
get_privacy(User, Server) ++
@ -186,7 +181,8 @@ export_user(User, Server, Fd) ->
{<<"password">>, Pass}],
children = Els})).
format_scram_password({StoredKey, ServerKey, Salt, IterationCount}) ->
format_scram_password(#scram{storedkey = StoredKey, serverkey = ServerKey,
salt = Salt, iterationcount = IterationCount}) ->
StoredKeyB64 = base64:encode(StoredKey),
ServerKeyB64 = base64:encode(ServerKey),
SaltB64 = base64:encode(Salt),