aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_auth.erl
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2011-08-16 00:28:25 +0200
committerBadlop <badlop@process-one.net>2011-08-16 00:28:25 +0200
commit24f5c964cda59b6f12d34fa3e4180817a8f1ea7d (patch)
treec0129a7709839f5ecf38776f6a8e4e03b1815ca9 /src/ejabberd_auth.erl
parentAdd comment about ping requests sent even to non-supporting clients (diff)
New SASL authentication method: SCRAM-SHA-1 (thanks to Stephen Röttger)(EJAB-1196)
Diffstat (limited to 'src/ejabberd_auth.erl')
-rw-r--r--src/ejabberd_auth.erl26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl
index 38876302e..344232c86 100644
--- a/src/ejabberd_auth.erl
+++ b/src/ejabberd_auth.erl
@@ -50,6 +50,7 @@
remove_user/2,
remove_user/3,
plain_password_required/1,
+ store_type/1,
entropy/1
]).
@@ -105,12 +106,31 @@ stop_methods(Host, Method) when is_atom(Method) ->
%% @spec (Server) -> bool()
%% Server = string()
+%% This is only executed by ejabberd_c2s for non-SASL auth client
plain_password_required(Server) when is_list(Server) ->
lists:any(
fun(M) ->
M:plain_password_required()
end, auth_modules(Server)).
+%% @spec (Server) -> bool()
+%% Server = string()
+
+store_type(Server) ->
+ lists:foldl(
+ fun(_, external) ->
+ external;
+ (M, scram) ->
+ case M:store_type() of
+ external ->
+ external;
+ _Else ->
+ scram
+ end;
+ (M, plain) ->
+ M:store_type()
+ end, plain, auth_modules(Server)).
+
%% @spec (User, Server, Password) -> bool()
%% User = string()
%% Server = string()
@@ -342,8 +362,10 @@ get_password_s(User, Server) when is_list(User), is_list(Server) ->
case get_password(User, Server) of
false ->
"";
- Password ->
- Password
+ Password when is_list(Password) ->
+ Password;
+ _ ->
+ ""
end.
%% @spec (User, Server) -> {Password, AuthModule} | {false, none}