25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +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) -> export_user(User, Server, Fd) ->
Password = ejabberd_auth:get_password_s(User, Server), Password = ejabberd_auth:get_password_s(User, Server),
LServer = jid:nameprep(Server), LServer = jid:nameprep(Server),
PasswordFormat = ejabberd_auth:password_format(LServer), Pass = case ejabberd_auth:password_format(LServer) of
Pass = case Password of scram -> format_scram_password(Password);
{_,_,_,_} -> _ -> Password
case PasswordFormat of end,
scram -> format_scram_password(Password);
_ -> <<"">>
end;
_ -> Password
end,
Els = get_offline(User, Server) ++ Els = get_offline(User, Server) ++
get_vcard(User, Server) ++ get_vcard(User, Server) ++
get_privacy(User, Server) ++ get_privacy(User, Server) ++
@ -186,7 +181,8 @@ export_user(User, Server, Fd) ->
{<<"password">>, Pass}], {<<"password">>, Pass}],
children = Els})). 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), StoredKeyB64 = base64:encode(StoredKey),
ServerKeyB64 = base64:encode(ServerKey), ServerKeyB64 = base64:encode(ServerKey),
SaltB64 = base64:encode(Salt), SaltB64 = base64:encode(Salt),