Skip to content

Commit

Permalink
Fix PIEFXIS export of user when password is scrammed (#2721)
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop committed Dec 19, 2018
1 parent 590bb0e commit 788d829
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/ejabberd_piefxis.erl
Expand Up @@ -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) ++
Expand All @@ -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),
Expand Down

0 comments on commit 788d829

Please sign in to comment.