mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +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 value is to deny such operations.
SVN Revision: 2949
This commit is contained in:
parent
03454c7f1d
commit
34234b4a46
@ -166,13 +166,20 @@ process_iq(From, To,
|
||||
#jid{user = User, lserver = Server} ->
|
||||
try_set_password(User, Server, Password, IQ, SubEl);
|
||||
_ ->
|
||||
case try_register(User, Server, Password,
|
||||
Source, Lang) of
|
||||
ok ->
|
||||
IQ#iq{type = result, sub_el = [SubEl]};
|
||||
{error, Error} ->
|
||||
case check_from(From, Server) of
|
||||
allow ->
|
||||
case try_register(User, Server, Password,
|
||||
Source, Lang) of
|
||||
ok ->
|
||||
IQ#iq{type = result,
|
||||
sub_el = [SubEl]};
|
||||
{error, Error} ->
|
||||
IQ#iq{type = error,
|
||||
sub_el = [SubEl, Error]}
|
||||
end;
|
||||
deny ->
|
||||
IQ#iq{type = error,
|
||||
sub_el = [SubEl, Error]}
|
||||
sub_el = [SubEl, ?ERR_FORBIDDEN]}
|
||||
end
|
||||
end;
|
||||
true ->
|
||||
@ -293,6 +300,11 @@ send_registration_notifications(UJID, Source) ->
|
||||
ok
|
||||
end.
|
||||
|
||||
check_from(#jid{user = "", server = ""}, _Server) ->
|
||||
allow;
|
||||
check_from(JID, Server) ->
|
||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access_from, none),
|
||||
acl:match_rule(Server, Access, JID).
|
||||
|
||||
check_timeout(undefined) ->
|
||||
true;
|
||||
|
Loading…
Reference in New Issue
Block a user