aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2012-08-27 16:57:56 +0200
committerBadlop <badlop@process-one.net>2012-08-27 16:57:56 +0200
commit8a737f875f36252dcac491e3d06ba567b5bda278 (patch)
treec6d909b371e563ed3f6ed54eeef1092d6a71e607 /src
parentAdded clause so ejabberdctl number of arguments error report works with R15 (diff)
Add SCRAM and remove MD5 support to ejabberd commands auth verification
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_commands.erl15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl
index 215a80876..92b2edc45 100644
--- a/src/ejabberd_commands.erl
+++ b/src/ejabberd_commands.erl
@@ -381,18 +381,13 @@ check_auth(noauth) ->
no_auth_provided;
check_auth({User, Server, Password}) ->
%% Check the account exists and password is valid
- AccountPass = ejabberd_auth:get_password_s(User, Server),
- AccountPassMD5 = get_md5(AccountPass),
- case Password of
- AccountPass -> {ok, User, Server};
- AccountPassMD5 -> {ok, User, Server};
- _ -> throw({error, invalid_account_data})
+ case ejabberd_auth:check_password(User, Server, Password) of
+ true ->
+ {ok, User, Server};
+ false ->
+ throw({error, invalid_account_data})
end.
-get_md5(AccountPass) ->
- lists:flatten([io_lib:format("~.16B", [X])
- || X <- binary_to_list(crypto:md5(AccountPass))]).
-
check_access(all, _) ->
true;
check_access(Access, Auth) ->