mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Added new acl for mod_register: access_from. This acl is applied if existing account tries to register a new account (either via s2s or c2s). The default action is to deny such operations.
SVN Revision: 2958
This commit is contained in:
parent
ad1aec6cd1
commit
1283a59465
@ -163,12 +163,17 @@ process_iq(From, To,
|
||||
{User, Server} ->
|
||||
try_set_password(User, Server, Password, IQ_Rec, SubEl);
|
||||
_ ->
|
||||
case check_from(From, Server) of
|
||||
allow ->
|
||||
case try_register(User, Server, Password,
|
||||
Source, Lang) of
|
||||
ok ->
|
||||
exmpp_iq:result(IQ_Rec, SubEl);
|
||||
{error, Error} ->
|
||||
exmpp_iq:error(IQ_Rec, Error)
|
||||
end;
|
||||
deny ->
|
||||
exmpp_iq:error(IQ_Rec, 'forbidden')
|
||||
end
|
||||
end;
|
||||
true ->
|
||||
@ -283,6 +288,14 @@ send_registration_notifications(UJID, Source) ->
|
||||
ok
|
||||
end.
|
||||
|
||||
check_from(JID, Server) ->
|
||||
case {exmpp_jid:node_as_list(JID), exmpp_jid:prep_domain_as_list(JID)} of
|
||||
{"", ""} ->
|
||||
allow;
|
||||
_ ->
|
||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access_from, none),
|
||||
acl:match_rule(Server, Access, JID)
|
||||
end.
|
||||
|
||||
check_timeout(undefined) ->
|
||||
true;
|
||||
|
Loading…
Reference in New Issue
Block a user