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} ->
|
{User, Server} ->
|
||||||
try_set_password(User, Server, Password, IQ_Rec, SubEl);
|
try_set_password(User, Server, Password, IQ_Rec, SubEl);
|
||||||
_ ->
|
_ ->
|
||||||
case try_register(User, Server, Password,
|
case check_from(From, Server) of
|
||||||
Source, Lang) of
|
allow ->
|
||||||
ok ->
|
case try_register(User, Server, Password,
|
||||||
exmpp_iq:result(IQ_Rec, SubEl);
|
Source, Lang) of
|
||||||
{error, Error} ->
|
ok ->
|
||||||
exmpp_iq:error(IQ_Rec, Error)
|
exmpp_iq:result(IQ_Rec, SubEl);
|
||||||
|
{error, Error} ->
|
||||||
|
exmpp_iq:error(IQ_Rec, Error)
|
||||||
|
end;
|
||||||
|
deny ->
|
||||||
|
exmpp_iq:error(IQ_Rec, 'forbidden')
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
true ->
|
true ->
|
||||||
@ -283,6 +288,14 @@ send_registration_notifications(UJID, Source) ->
|
|||||||
ok
|
ok
|
||||||
end.
|
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) ->
|
check_timeout(undefined) ->
|
||||||
true;
|
true;
|
||||||
|
Loading…
Reference in New Issue
Block a user