24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

fixes allow_host/2 on subdomains. added hook s2s_allow_host: the hook should return deny or allow

SVN Revision: 2738
This commit is contained in:
Evgeniy Khramtsov 2009-11-13 16:19:46 +00:00
parent 1511a5dc82
commit 311bf4dbb1

View File

@ -486,15 +486,31 @@ update_tables() ->
%% Check if host is in blacklist or white list %% Check if host is in blacklist or white list
allow_host(MyServer, S2SHost) -> allow_host(MyServer, S2SHost) ->
case ejabberd_config:get_local_option({{s2s_host, S2SHost},MyServer}) of case lists:filter(
deny -> false; fun(Host) ->
allow -> true; is_subdomain(MyServer, Host)
_ -> end, ?MYHOSTS) of
case ejabberd_config:get_local_option({s2s_default_policy, MyServer}) of [MyHost|_] ->
deny -> false; allow_host1(MyHost, S2SHost);
allow -> true; [] ->
_ -> true %% The default s2s policy is allow allow_host1(MyServer, S2SHost)
end end.
allow_host1(MyHost, S2SHost) ->
case ejabberd_config:get_local_option({{s2s_host, S2SHost}, MyHost}) of
deny -> false;
allow -> true;
_ ->
case ejabberd_config:get_local_option({s2s_default_policy, MyHost}) of
deny -> false;
_ ->
case ejabberd_hooks:run_fold(s2s_allow_host, MyHost,
allow, [MyHost, S2SHost]) of
deny -> false;
allow -> true;
_ -> true
end
end
end. end.
%% Get information about S2S connections of the specified type. %% Get information about S2S connections of the specified type.