aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_auth.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/ejabberd_auth.erl')
-rw-r--r--src/ejabberd_auth.erl14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl
index 34d4a52b2..991cb664b 100644
--- a/src/ejabberd_auth.erl
+++ b/src/ejabberd_auth.erl
@@ -71,8 +71,8 @@
-callback get_vh_registered_users(binary(), opts()) -> [{binary(), binary()}].
-callback get_vh_registered_users_number(binary()) -> number().
-callback get_vh_registered_users_number(binary(), opts()) -> number().
--callback get_password(binary(), binary()) -> false | binary().
--callback get_password_s(binary(), binary()) -> binary().
+-callback get_password(binary(), binary()) -> false | binary() | {binary(), binary(), binary(), integer()}.
+-callback get_password_s(binary(), binary()) -> binary() | {binary(), binary(), binary(), integer()}.
start() ->
%% This is only executed by ejabberd_c2s for non-SASL auth client
@@ -267,7 +267,7 @@ get_vh_registered_users_number(Server, Opts) ->
end,
auth_modules(Server))).
--spec get_password(binary(), binary()) -> false | binary().
+-spec get_password(binary(), binary()) -> false | binary() | {binary(), binary(), binary(), integer()}.
get_password(User, Server) ->
lists:foldl(fun (M, false) ->
@@ -276,7 +276,7 @@ get_password(User, Server) ->
end,
false, auth_modules(Server)).
--spec get_password_s(binary(), binary()) -> binary().
+-spec get_password_s(binary(), binary()) -> binary() | {binary(), binary(), binary(), integer()}.
get_password_s(User, Server) ->
case get_password(User, Server) of
@@ -425,6 +425,10 @@ auth_modules() ->
%% Return the list of authenticated modules for a given host
auth_modules(Server) ->
LServer = jlib:nameprep(Server),
+ Default = case gen_mod:default_db(LServer) of
+ mnesia -> internal;
+ DBType -> DBType
+ end,
Methods = ejabberd_config:get_option(
{auth_method, LServer},
fun(V) when is_list(V) ->
@@ -432,7 +436,7 @@ auth_modules(Server) ->
V;
(V) when is_atom(V) ->
[V]
- end, []),
+ end, [Default]),
[jlib:binary_to_atom(<<"ejabberd_auth_",
(jlib:atom_to_binary(M))/binary>>)
|| M <- Methods].