mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Report in SQL when scram is enabled but the stored password isn't (#1096)
This commit is contained in:
parent
bbb90b9928
commit
5352037680
@ -88,7 +88,7 @@ check_password(User, AuthzId, Server, Password) ->
|
|||||||
serverkey = ServerKey,
|
serverkey = ServerKey,
|
||||||
salt = Salt,
|
salt = Salt,
|
||||||
iterationcount = IterationCount},
|
iterationcount = IterationCount},
|
||||||
is_password_scram_valid(Password, Scram);
|
is_password_scram_valid_stored(Password, Scram, LUser, LServer);
|
||||||
{selected, []} ->
|
{selected, []} ->
|
||||||
false; %% Account does not exist
|
false; %% Account does not exist
|
||||||
{error, _Error} ->
|
{error, _Error} ->
|
||||||
@ -417,6 +417,15 @@ password_to_scram(Password, IterationCount) ->
|
|||||||
salt = jlib:encode_base64(Salt),
|
salt = jlib:encode_base64(Salt),
|
||||||
iterationcount = IterationCount}.
|
iterationcount = IterationCount}.
|
||||||
|
|
||||||
|
is_password_scram_valid_stored(Pass, {scram,Pass,<<>>,<<>>,0}, LUser, LServer) ->
|
||||||
|
?INFO_MSG("Apparently, SQL auth method and scram password formatting are "
|
||||||
|
"enabled, but the password of user '~s' in the 'users' table is not "
|
||||||
|
"scrammed. You may want to execute this command: "
|
||||||
|
"ejabberdctl convert_to_scram ~s", [LUser, LServer]),
|
||||||
|
false;
|
||||||
|
is_password_scram_valid_stored(Password, Scram, _, _) ->
|
||||||
|
is_password_scram_valid(Password, Scram).
|
||||||
|
|
||||||
is_password_scram_valid(Password, Scram) ->
|
is_password_scram_valid(Password, Scram) ->
|
||||||
IterationCount = Scram#scram.iterationcount,
|
IterationCount = Scram#scram.iterationcount,
|
||||||
Salt = jlib:decode_base64(Scram#scram.salt),
|
Salt = jlib:decode_base64(Scram#scram.salt),
|
||||||
|
Loading…
Reference in New Issue
Block a user