Make anonymous auth not override sasl mechaninsm offered by other modules

This stop overriding store_type when anonymous is enabled with other
auth modules, we don't really need that since anonymous is not taking
passwords anyway, and this was disabling scram mechanisms.

This fixes issue #2803.
This commit is contained in:
Paweł Chmielowski 2020-12-14 16:42:14 +01:00
parent a9ed26e484
commit d8d9ef32ad
1 changed files with 15 additions and 10 deletions

View File

@ -197,16 +197,21 @@ plain_password_required(Server) ->
-spec store_type(binary()) -> plain | scram | external.
store_type(Server) ->
lists:foldl(
fun(_, external) -> external;
(M, scram) ->
case M:store_type(Server) of
external -> external;
_ -> scram
end;
(M, plain) ->
M:store_type(Server)
end, plain, auth_modules(Server)).
case auth_modules(Server) of
[ejabberd_auth_anonymous] -> external;
Modules ->
lists:foldl(
fun(ejabberd_auth_anonymous, Type) -> Type;
(_, external) -> external;
(M, scram) ->
case M:store_type(Server) of
external -> external;
_ -> scram
end;
(M, plain) ->
M:store_type(Server)
end, plain, Modules)
end.
-spec check_password(binary(), binary(), binary(), binary()) -> boolean().
check_password(User, AuthzId, Server, Password) ->