mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
Use {access,shaper}_rules_validator in other places where access rules are used
This commit is contained in:
parent
52d45604ba
commit
3a8da27d86
@ -259,14 +259,10 @@ close(FsmRef) -> (?GEN_FSM):send_event(FsmRef, closed).
|
|||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
|
|
||||||
init([{SockMod, Socket}, Opts]) ->
|
init([{SockMod, Socket}, Opts]) ->
|
||||||
Access = case lists:keysearch(access, 1, Opts) of
|
Access = gen_mod:get_opt(access, Opts,
|
||||||
{value, {_, A}} -> A;
|
fun acl:access_rules_validator/1, all),
|
||||||
_ -> all
|
Shaper = gen_mod:get_opt(shaper, Opts,
|
||||||
end,
|
fun acl:shaper_rules_validator/1, none),
|
||||||
Shaper = case lists:keysearch(shaper, 1, Opts) of
|
|
||||||
{value, {_, S}} -> S;
|
|
||||||
_ -> none
|
|
||||||
end,
|
|
||||||
XMLSocket = case lists:keysearch(xml_socket, 1, Opts) of
|
XMLSocket = case lists:keysearch(xml_socket, 1, Opts) of
|
||||||
{value, {_, XS}} -> XS;
|
{value, {_, XS}} -> XS;
|
||||||
_ -> false
|
_ -> false
|
||||||
|
@ -130,7 +130,7 @@ authenticate_user({User, Server}, {password, Password} = Ctx) ->
|
|||||||
Access =
|
Access =
|
||||||
ejabberd_config:get_option(
|
ejabberd_config:get_option(
|
||||||
{oauth_access, JID#jid.lserver},
|
{oauth_access, JID#jid.lserver},
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
none),
|
none),
|
||||||
case acl:match_rule(JID#jid.lserver, Access, JID) of
|
case acl:match_rule(JID#jid.lserver, Access, JID) of
|
||||||
allow ->
|
allow ->
|
||||||
@ -486,5 +486,5 @@ logo() ->
|
|||||||
opt_type(oauth_expire) ->
|
opt_type(oauth_expire) ->
|
||||||
fun(I) when is_integer(I), I >= 0 -> I end;
|
fun(I) when is_integer(I), I >= 0 -> I end;
|
||||||
opt_type(oauth_access) ->
|
opt_type(oauth_access) ->
|
||||||
fun(A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
opt_type(_) -> [oauth_expire, oauth_access].
|
opt_type(_) -> [oauth_expire, oauth_access].
|
||||||
|
@ -539,7 +539,7 @@ allow_host2(MyServer, S2SHost) ->
|
|||||||
allow_host1(MyHost, S2SHost) ->
|
allow_host1(MyHost, S2SHost) ->
|
||||||
Rule = ejabberd_config:get_option(
|
Rule = ejabberd_config:get_option(
|
||||||
s2s_access,
|
s2s_access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
all),
|
all),
|
||||||
JID = jid:make(<<"">>, S2SHost, <<"">>),
|
JID = jid:make(<<"">>, S2SHost, <<"">>),
|
||||||
case acl:match_rule(MyHost, Rule, JID) of
|
case acl:match_rule(MyHost, Rule, JID) of
|
||||||
@ -738,5 +738,5 @@ opt_type(route_subdomains) ->
|
|||||||
(local) -> local
|
(local) -> local
|
||||||
end;
|
end;
|
||||||
opt_type(s2s_access) ->
|
opt_type(s2s_access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
opt_type(_) -> [route_subdomains, s2s_access].
|
opt_type(_) -> [route_subdomains, s2s_access].
|
||||||
|
@ -903,7 +903,7 @@ send_announcement_to_all(Host, SubjectS, BodyS) ->
|
|||||||
|
|
||||||
get_access(Host) ->
|
get_access(Host) ->
|
||||||
gen_mod:get_module_opt(Host, ?MODULE, access,
|
gen_mod:get_module_opt(Host, ?MODULE, access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
none).
|
none).
|
||||||
|
|
||||||
%%-------------------------------------------------------------------------
|
%%-------------------------------------------------------------------------
|
||||||
@ -920,6 +920,6 @@ import(LServer, DBType, LA) ->
|
|||||||
Mod:import(LServer, LA).
|
Mod:import(LServer, LA).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
||||||
mod_opt_type(_) -> [access, db_type].
|
mod_opt_type(_) -> [access, db_type].
|
||||||
|
@ -167,7 +167,7 @@ code_change(_OldVsn, State, _Extra) ->
|
|||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
is_whitelisted(Host, Addr) ->
|
is_whitelisted(Host, Addr) ->
|
||||||
Access = gen_mod:get_module_opt(Host, ?MODULE, access,
|
Access = gen_mod:get_module_opt(Host, ?MODULE, access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
none),
|
none),
|
||||||
acl:match_rule(Host, Access, Addr) == allow.
|
acl:match_rule(Host, Access, Addr) == allow.
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ format_date({{Year, Month, Day}, {Hour, Minute, Second}}) ->
|
|||||||
[Hour, Minute, Second, Day, Month, Year]).
|
[Hour, Minute, Second, Day, Month, Year]).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(c2s_auth_ban_lifetime) ->
|
mod_opt_type(c2s_auth_ban_lifetime) ->
|
||||||
fun (T) when is_integer(T), T > 0 -> T end;
|
fun (T) when is_integer(T), T > 0 -> T end;
|
||||||
mod_opt_type(c2s_max_auth_failures) ->
|
mod_opt_type(c2s_max_auth_failures) ->
|
||||||
|
@ -178,7 +178,7 @@ mod_opt_type(host) ->
|
|||||||
mod_opt_type(name) ->
|
mod_opt_type(name) ->
|
||||||
fun iolist_to_binary/1;
|
fun iolist_to_binary/1;
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun(A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(max_size) ->
|
mod_opt_type(max_size) ->
|
||||||
fun(I) when is_integer(I), I > 0 -> I;
|
fun(I) when is_integer(I), I > 0 -> I;
|
||||||
(infinity) -> infinity
|
(infinity) -> infinity
|
||||||
@ -235,7 +235,7 @@ init({ServerHost, Opts}) ->
|
|||||||
fun iolist_to_binary/1,
|
fun iolist_to_binary/1,
|
||||||
<<"HTTP File Upload">>),
|
<<"HTTP File Upload">>),
|
||||||
Access = gen_mod:get_opt(access, Opts,
|
Access = gen_mod:get_opt(access, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:access_rules_validator/1,
|
||||||
local),
|
local),
|
||||||
MaxSize = gen_mod:get_opt(max_size, Opts,
|
MaxSize = gen_mod:get_opt(max_size, Opts,
|
||||||
fun(I) when is_integer(I), I > 0 -> I;
|
fun(I) when is_integer(I), I > 0 -> I;
|
||||||
|
@ -99,9 +99,9 @@ stop(ServerHost) ->
|
|||||||
-spec mod_opt_type(atom()) -> fun((term()) -> term()) | [atom()].
|
-spec mod_opt_type(atom()) -> fun((term()) -> term()) | [atom()].
|
||||||
|
|
||||||
mod_opt_type(access_soft_quota) ->
|
mod_opt_type(access_soft_quota) ->
|
||||||
fun(A) when is_atom(A) -> A end;
|
fun acl:shaper_rules_validator/1;
|
||||||
mod_opt_type(access_hard_quota) ->
|
mod_opt_type(access_hard_quota) ->
|
||||||
fun(A) when is_atom(A) -> A end;
|
fun acl:shaper_rules_validator/1;
|
||||||
mod_opt_type(max_days) ->
|
mod_opt_type(max_days) ->
|
||||||
fun(I) when is_integer(I), I > 0 -> I;
|
fun(I) when is_integer(I), I > 0 -> I;
|
||||||
(infinity) -> infinity
|
(infinity) -> infinity
|
||||||
@ -118,10 +118,10 @@ mod_opt_type(_) ->
|
|||||||
init({ServerHost, Opts}) ->
|
init({ServerHost, Opts}) ->
|
||||||
process_flag(trap_exit, true),
|
process_flag(trap_exit, true),
|
||||||
AccessSoftQuota = gen_mod:get_opt(access_soft_quota, Opts,
|
AccessSoftQuota = gen_mod:get_opt(access_soft_quota, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:shaper_rules_validator/1,
|
||||||
soft_upload_quota),
|
soft_upload_quota),
|
||||||
AccessHardQuota = gen_mod:get_opt(access_hard_quota, Opts,
|
AccessHardQuota = gen_mod:get_opt(access_hard_quota, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:shaper_rules_validator/1,
|
||||||
hard_upload_quota),
|
hard_upload_quota),
|
||||||
MaxDays = gen_mod:get_opt(max_days, Opts,
|
MaxDays = gen_mod:get_opt(max_days, Opts,
|
||||||
fun(I) when is_integer(I), I > 0 -> I;
|
fun(I) when is_integer(I), I > 0 -> I;
|
||||||
|
@ -117,7 +117,7 @@ init([Host, Opts]) ->
|
|||||||
Mod = gen_mod:db_mod(Host, Opts, ?MODULE),
|
Mod = gen_mod:db_mod(Host, Opts, ?MODULE),
|
||||||
Mod:init(Host, Opts),
|
Mod:init(Host, Opts),
|
||||||
Access = gen_mod:get_opt(access, Opts,
|
Access = gen_mod:get_opt(access, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:access_rules_validator/1,
|
||||||
all),
|
all),
|
||||||
catch ets:new(irc_connection,
|
catch ets:new(irc_connection,
|
||||||
[named_table, public,
|
[named_table, public,
|
||||||
@ -1252,7 +1252,7 @@ import(LServer, DBType, Data) ->
|
|||||||
Mod:import(LServer, Data).
|
Mod:import(LServer, Data).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
||||||
mod_opt_type(default_encoding) ->
|
mod_opt_type(default_encoding) ->
|
||||||
fun iolist_to_binary/1;
|
fun iolist_to_binary/1;
|
||||||
|
@ -193,14 +193,14 @@ init([Host, Opts]) ->
|
|||||||
clean_table_from_bad_node(node(), MyHost),
|
clean_table_from_bad_node(node(), MyHost),
|
||||||
mnesia:subscribe(system),
|
mnesia:subscribe(system),
|
||||||
Access = gen_mod:get_opt(access, Opts,
|
Access = gen_mod:get_opt(access, Opts,
|
||||||
fun(A) when is_atom(A) -> A end, all),
|
fun acl:access_rules_validator/1, all),
|
||||||
AccessCreate = gen_mod:get_opt(access_create, Opts,
|
AccessCreate = gen_mod:get_opt(access_create, Opts,
|
||||||
fun(A) when is_atom(A) -> A end, all),
|
fun acl:access_rules_validator/1, all),
|
||||||
AccessAdmin = gen_mod:get_opt(access_admin, Opts,
|
AccessAdmin = gen_mod:get_opt(access_admin, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:access_rules_validator/1,
|
||||||
none),
|
none),
|
||||||
AccessPersistent = gen_mod:get_opt(access_persistent, Opts,
|
AccessPersistent = gen_mod:get_opt(access_persistent, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:access_rules_validator/1,
|
||||||
all),
|
all),
|
||||||
HistorySize = gen_mod:get_opt(history_size, Opts,
|
HistorySize = gen_mod:get_opt(history_size, Opts,
|
||||||
fun(I) when is_integer(I), I>=0 -> I end,
|
fun(I) when is_integer(I), I>=0 -> I end,
|
||||||
@ -925,13 +925,13 @@ import(LServer, DBType, Data) ->
|
|||||||
Mod:import(LServer, Data).
|
Mod:import(LServer, Data).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(access_admin) ->
|
mod_opt_type(access_admin) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(access_create) ->
|
mod_opt_type(access_create) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(access_persistent) ->
|
mod_opt_type(access_persistent) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
||||||
mod_opt_type(default_room_options) ->
|
mod_opt_type(default_room_options) ->
|
||||||
fun (L) when is_list(L) -> L end;
|
fun (L) when is_list(L) -> L end;
|
||||||
|
@ -141,7 +141,7 @@ init([Host, Opts]) ->
|
|||||||
fun iolist_to_binary/1,
|
fun iolist_to_binary/1,
|
||||||
false),
|
false),
|
||||||
AccessLog = gen_mod:get_opt(access_log, Opts,
|
AccessLog = gen_mod:get_opt(access_log, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:access_rules_validator/1,
|
||||||
muc_admin),
|
muc_admin),
|
||||||
Timezone = gen_mod:get_opt(timezone, Opts,
|
Timezone = gen_mod:get_opt(timezone, Opts,
|
||||||
fun(local) -> local;
|
fun(local) -> local;
|
||||||
|
@ -140,7 +140,7 @@ init([LServerS, Opts]) ->
|
|||||||
LServiceS = gen_mod:get_opt_host(LServerS, Opts,
|
LServiceS = gen_mod:get_opt_host(LServerS, Opts,
|
||||||
<<"multicast.@HOST@">>),
|
<<"multicast.@HOST@">>),
|
||||||
Access = gen_mod:get_opt(access, Opts,
|
Access = gen_mod:get_opt(access, Opts,
|
||||||
fun (A) when is_atom(A) -> A end, all),
|
fun acl:access_rules_validator/1, all),
|
||||||
SLimits =
|
SLimits =
|
||||||
build_service_limit_record(gen_mod:get_opt(limits, Opts,
|
build_service_limit_record(gen_mod:get_opt(limits, Opts,
|
||||||
fun (A) when is_list(A) ->
|
fun (A) when is_list(A) ->
|
||||||
@ -1220,7 +1220,7 @@ stj(String) -> jid:from_string(String).
|
|||||||
jts(String) -> jid:to_string(String).
|
jts(String) -> jid:to_string(String).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(host) -> fun iolist_to_binary/1;
|
mod_opt_type(host) -> fun iolist_to_binary/1;
|
||||||
mod_opt_type(limits) ->
|
mod_opt_type(limits) ->
|
||||||
fun (A) when is_list(A) -> A end;
|
fun (A) when is_list(A) -> A end;
|
||||||
|
@ -162,7 +162,7 @@ init([Host, Opts]) ->
|
|||||||
?MODULE, handle_offline_query, IQDisc),
|
?MODULE, handle_offline_query, IQDisc),
|
||||||
AccessMaxOfflineMsgs =
|
AccessMaxOfflineMsgs =
|
||||||
gen_mod:get_opt(access_max_user_messages, Opts,
|
gen_mod:get_opt(access_max_user_messages, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:shaper_rules_validator/1,
|
||||||
max_user_offline_messages),
|
max_user_offline_messages),
|
||||||
{ok,
|
{ok,
|
||||||
#state{host = Host,
|
#state{host = Host,
|
||||||
@ -866,7 +866,7 @@ import(LServer, DBType, Data) ->
|
|||||||
Mod:import(LServer, Data).
|
Mod:import(LServer, Data).
|
||||||
|
|
||||||
mod_opt_type(access_max_user_messages) ->
|
mod_opt_type(access_max_user_messages) ->
|
||||||
fun (A) -> A end;
|
fun acl:shaper_rules_validator/1;
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
||||||
mod_opt_type(store_empty_body) ->
|
mod_opt_type(store_empty_body) ->
|
||||||
fun (V) when is_boolean(V) -> V;
|
fun (V) when is_boolean(V) -> V;
|
||||||
|
@ -260,7 +260,7 @@ parse_options(ServerHost, Opts) ->
|
|||||||
Port = gen_mod:get_opt(port, Opts,
|
Port = gen_mod:get_opt(port, Opts,
|
||||||
fun(P) when is_integer(P), P>0, P<65536 -> P end,
|
fun(P) when is_integer(P), P>0, P<65536 -> P end,
|
||||||
7777),
|
7777),
|
||||||
ACL = gen_mod:get_opt(access, Opts, fun(A) when is_atom(A) -> A end,
|
ACL = gen_mod:get_opt(access, Opts, fun acl:access_rules_validator/1,
|
||||||
all),
|
all),
|
||||||
Name = gen_mod:get_opt(name, Opts, fun iolist_to_binary/1,
|
Name = gen_mod:get_opt(name, Opts, fun iolist_to_binary/1,
|
||||||
<<"SOCKS5 Bytestreams">>),
|
<<"SOCKS5 Bytestreams">>),
|
||||||
|
@ -83,7 +83,7 @@ init([Socket, Host, Opts]) ->
|
|||||||
(anonymous) -> anonymous
|
(anonymous) -> anonymous
|
||||||
end, anonymous),
|
end, anonymous),
|
||||||
Shaper = gen_mod:get_opt(shaper, Opts,
|
Shaper = gen_mod:get_opt(shaper, Opts,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun acl:shaper_rules_validator/1,
|
||||||
none),
|
none),
|
||||||
RecvBuf = gen_mod:get_opt(recbuf, Opts,
|
RecvBuf = gen_mod:get_opt(recbuf, Opts,
|
||||||
fun(I) when is_integer(I), I>0 -> I end,
|
fun(I) when is_integer(I), I>0 -> I end,
|
||||||
|
@ -74,7 +74,7 @@ stop(Host) ->
|
|||||||
|
|
||||||
stream_feature_register(Acc, Host) ->
|
stream_feature_register(Acc, Host) ->
|
||||||
AF = gen_mod:get_module_opt(Host, ?MODULE, access_from,
|
AF = gen_mod:get_module_opt(Host, ?MODULE, access_from,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
all),
|
all),
|
||||||
case (AF /= none) and lists:keymember(<<"mechanisms">>, 2, Acc) of
|
case (AF /= none) and lists:keymember(<<"mechanisms">>, 2, Acc) of
|
||||||
true ->
|
true ->
|
||||||
@ -126,7 +126,7 @@ process_iq(From, To,
|
|||||||
RTag = fxml:get_subtag(SubEl, <<"remove">>),
|
RTag = fxml:get_subtag(SubEl, <<"remove">>),
|
||||||
Server = To#jid.lserver,
|
Server = To#jid.lserver,
|
||||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access,
|
Access = gen_mod:get_module_opt(Server, ?MODULE, access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
all),
|
all),
|
||||||
AllowRemove = allow ==
|
AllowRemove = allow ==
|
||||||
acl:match_rule(Server, Access, From),
|
acl:match_rule(Server, Access, From),
|
||||||
@ -402,7 +402,7 @@ try_register(User, Server, Password, SourceRaw, Lang) ->
|
|||||||
_ ->
|
_ ->
|
||||||
JID = jid:make(User, Server, <<"">>),
|
JID = jid:make(User, Server, <<"">>),
|
||||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access,
|
Access = gen_mod:get_module_opt(Server, ?MODULE, access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
all),
|
all),
|
||||||
IPAccess = get_ip_access(Server),
|
IPAccess = get_ip_access(Server),
|
||||||
case {acl:match_rule(Server, Access, JID),
|
case {acl:match_rule(Server, Access, JID),
|
||||||
@ -528,7 +528,7 @@ check_from(#jid{user = <<"">>, server = <<"">>},
|
|||||||
allow;
|
allow;
|
||||||
check_from(JID, Server) ->
|
check_from(JID, Server) ->
|
||||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access_from,
|
Access = gen_mod:get_module_opt(Server, ?MODULE, access_from,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
none),
|
none),
|
||||||
acl:match_rule(Server, Access, JID).
|
acl:match_rule(Server, Access, JID).
|
||||||
|
|
||||||
@ -736,13 +736,13 @@ check_ip_access(IPAddress, IPAccess) ->
|
|||||||
acl:match_rule(global, IPAccess, IPAddress).
|
acl:match_rule(global, IPAccess, IPAddress).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(access_from) ->
|
mod_opt_type(access_from) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun (A) when is_atom(A) -> A end;
|
||||||
mod_opt_type(captcha_protected) ->
|
mod_opt_type(captcha_protected) ->
|
||||||
fun (B) when is_boolean(B) -> B end;
|
fun (B) when is_boolean(B) -> B end;
|
||||||
mod_opt_type(ip_access) ->
|
mod_opt_type(ip_access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
|
mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
|
||||||
mod_opt_type(password_strength) ->
|
mod_opt_type(password_strength) ->
|
||||||
fun (N) when is_number(N), N >= 0 -> N end;
|
fun (N) when is_number(N), N >= 0 -> N end;
|
||||||
|
@ -491,7 +491,7 @@ form_del_get(Host, Lang) ->
|
|||||||
%% {error, invalid_jid}
|
%% {error, invalid_jid}
|
||||||
register_account(Username, Host, Password) ->
|
register_account(Username, Host, Password) ->
|
||||||
Access = gen_mod:get_module_opt(Host, mod_register, access,
|
Access = gen_mod:get_module_opt(Host, mod_register, access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(A) -> A end,
|
||||||
all),
|
all),
|
||||||
case jid:make(Username, Host, <<"">>) of
|
case jid:make(Username, Host, <<"">>) of
|
||||||
error -> {error, invalid_jid};
|
error -> {error, invalid_jid};
|
||||||
|
@ -351,7 +351,7 @@ get_roster_by_jid_t(LUser, LServer, LJID) ->
|
|||||||
|
|
||||||
try_process_iq_set(From, To, #iq{sub_el = SubEl, lang = Lang} = IQ) ->
|
try_process_iq_set(From, To, #iq{sub_el = SubEl, lang = Lang} = IQ) ->
|
||||||
#jid{server = Server} = From,
|
#jid{server = Server} = From,
|
||||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access, fun(A) when is_atom(A) -> A end, all),
|
Access = gen_mod:get_module_opt(Server, ?MODULE, access, fun(A) -> A end, all),
|
||||||
case acl:match_rule(Server, Access, From) of
|
case acl:match_rule(Server, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Denied by ACL">>,
|
||||||
@ -1235,7 +1235,7 @@ import(LServer, DBType, R) ->
|
|||||||
Mod:import(LServer, R).
|
Mod:import(LServer, R).
|
||||||
|
|
||||||
mod_opt_type(access) ->
|
mod_opt_type(access) ->
|
||||||
fun (A) when is_atom(A) -> A end;
|
fun acl:access_rules_validator/1;
|
||||||
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
|
||||||
mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
|
mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
|
||||||
mod_opt_type(managers) ->
|
mod_opt_type(managers) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user