ejabberd_auth: Don't use cache if it's disabled

Don't let the check whether a user exists use the cache if caching was
disabled in the configuration.
This commit is contained in:
Holger Weiss 2018-05-03 00:31:33 +02:00
parent 638f2d2e67
commit 410db89167
1 changed files with 4 additions and 2 deletions

View File

@ -545,8 +545,8 @@ db_user_exists(User, Server, Mod) ->
{ok, _} -> {ok, _} ->
true; true;
error -> error ->
case Mod:store_type(Server) of case {Mod:store_type(Server), use_cache(Mod, Server)} of
external -> {external, true} ->
case ets_cache:lookup( case ets_cache:lookup(
?AUTH_CACHE, {User, Server}, ?AUTH_CACHE, {User, Server},
fun() -> fun() ->
@ -561,6 +561,8 @@ db_user_exists(User, Server, Mod) ->
error -> error ->
false false
end; end;
{external, false} ->
Mod:user_exists(User, Server);
_ -> _ ->
false false
end end