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,8 +197,12 @@ plain_password_required(Server) ->
-spec store_type(binary()) -> plain | scram | external. -spec store_type(binary()) -> plain | scram | external.
store_type(Server) -> store_type(Server) ->
case auth_modules(Server) of
[ejabberd_auth_anonymous] -> external;
Modules ->
lists:foldl( lists:foldl(
fun(_, external) -> external; fun(ejabberd_auth_anonymous, Type) -> Type;
(_, external) -> external;
(M, scram) -> (M, scram) ->
case M:store_type(Server) of case M:store_type(Server) of
external -> external; external -> external;
@ -206,7 +210,8 @@ store_type(Server) ->
end; end;
(M, plain) -> (M, plain) ->
M:store_type(Server) M:store_type(Server)
end, plain, auth_modules(Server)). end, plain, Modules)
end.
-spec check_password(binary(), binary(), binary(), binary()) -> boolean(). -spec check_password(binary(), binary(), binary(), binary()) -> boolean().
check_password(User, AuthzId, Server, Password) -> check_password(User, AuthzId, Server, Password) ->