24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-09-21 14:06:57 +02: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,13 +166,8 @@ 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
{_,_,_,_} ->
case PasswordFormat of
scram -> format_scram_password(Password); scram -> format_scram_password(Password);
_ -> <<"">>
end;
_ -> Password _ -> Password
end, end,
Els = get_offline(User, Server) ++ Els = get_offline(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),