]> granicus.if.org Git - ejabberd/commitdiff
Correctly support cache tags in ejabberd_auth
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Fri, 19 Apr 2019 12:42:24 +0000 (15:42 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Fri, 19 Apr 2019 12:42:24 +0000 (15:42 +0300)
src/ejabberd_auth.erl

index dfe3f534a4a8cf1e39972eb64bb9b8a3f6fc0974..7d659113594f6f6384ba61336ce7752aa9efa5af 100644 (file)
@@ -613,7 +613,10 @@ db_user_exists(User, Server, Mod) ->
                                   case Mod:user_exists(User, Server) of
                                       true -> {ok, exists};
                                       false -> error;
-                                      {error, _} = Err -> Err
+                                      {error, _} = Err -> Err;
+                                      {CacheTag, true} -> {CacheTag, {ok, exists}};
+                                      {CacheTag, false} -> {CacheTag, error};
+                                      {_, {error, _}} = Err -> Err
                                   end
                           end) of
                        {ok, _} ->
@@ -643,10 +646,10 @@ db_check_password(User, AuthzId, Server, ProvidedPassword,
                           fun() ->
                                   case Mod:check_password(
                                          User, AuthzId, Server, ProvidedPassword) of
-                                      true ->
-                                          {ok, ProvidedPassword};
-                                      false ->
-                                          error
+                                      true -> {ok, ProvidedPassword};
+                                      false -> error;
+                                      {CacheTag, true} -> {CacheTag, {ok, ProvidedPassword}};
+                                      {CacheTag, false} -> {CacheTag, error}
                                   end
                           end) of
                        {ok, _} ->