25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Update auth modules to support stopping

This commit is contained in:
Badlop 2010-12-22 17:54:41 +01:00
parent 0859667a8c
commit 75f2e775ab
4 changed files with 28 additions and 0 deletions

View File

@ -28,6 +28,7 @@
-author('mickael.remond@process-one.net'). -author('mickael.remond@process-one.net').
-export([start/1, -export([start/1,
stop/1,
allow_anonymous/1, allow_anonymous/1,
is_sasl_anonymous_enabled/1, is_sasl_anonymous_enabled/1,
is_login_anonymous_enabled/1, is_login_anonymous_enabled/1,
@ -79,6 +80,14 @@ start(Host) when is_list(Host) ->
?MODULE, unregister_connection, 100), ?MODULE, unregister_connection, 100),
ok. ok.
stop(Host) when is_list(Host) ->
HostB = list_to_binary(Host),
ejabberd_hooks:delete(sm_register_connection_hook, HostB,
?MODULE, register_connection, 100),
ejabberd_hooks:delete(sm_remove_connection_hook, HostB,
?MODULE, unregister_connection, 100),
ok.
%% @spec (Host) -> bool() %% @spec (Host) -> bool()
%% Host = string() %% Host = string()
%% @doc Return true if anonymous is allowed for host or false otherwise. %% @doc Return true if anonymous is allowed for host or false otherwise.

View File

@ -29,6 +29,7 @@
%% External exports %% External exports
-export([start/1, -export([start/1,
stop/1,
set_password/3, set_password/3,
check_password/3, check_password/3,
check_password/5, check_password/5,
@ -65,6 +66,15 @@ start(Host) ->
ok ok
end. end.
stop(Host) ->
extauth:stop(Host),
case check_cache_last_options(Host) of
cache ->
ok = ejabberd_auth_storage:stop(Host);
no_cache ->
ok
end.
check_cache_last_options(Server) -> check_cache_last_options(Server) ->
%% if extauth_cache is enabled, then a mod_last module must also be enabled %% if extauth_cache is enabled, then a mod_last module must also be enabled
case get_cache_option(Server) of case get_cache_option(Server) of

View File

@ -28,6 +28,7 @@
%% External exports %% External exports
-export([start/1, -export([start/1,
stop/1,
set_password/3, set_password/3,
check_password/3, check_password/3,
check_password/5, check_password/5,
@ -56,6 +57,10 @@ start(_Host) ->
Err -> Err Err -> Err
end. end.
%% TODO: Stop epam if no other auth_pam are running.
stop(_Host) ->
ok.
%% @spec (User, Server, Password) -> {error, not_allowed} %% @spec (User, Server, Password) -> {error, not_allowed}
%% User = string() %% User = string()
%% Server = string() %% Server = string()

View File

@ -54,6 +54,7 @@
%% External exports %% External exports
-export([start/1, -export([start/1,
stop/1,
set_password/3, set_password/3,
check_password/3, check_password/3,
check_password/5, check_password/5,
@ -103,6 +104,9 @@ start(Host) ->
update_reg_users_counter_table(Host), update_reg_users_counter_table(Host),
ok. ok.
stop(_Host) ->
ok.
update_reg_users_counter_table(Server) -> update_reg_users_counter_table(Server) ->
Set = get_vh_registered_users(Server), Set = get_vh_registered_users(Server),
Size = length(Set), Size = length(Set),