aboutsummaryrefslogtreecommitdiff
path: root/src/mod_register.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <xramtsov@gmail.com>2010-01-31 13:55:10 +0000
committerEvgeniy Khramtsov <xramtsov@gmail.com>2010-01-31 13:55:10 +0000
commit34234b4a46df8e3ddfe0ac243f3bdb7a258730ee (patch)
tree27f093d607d61797309d1c837f48b73396c83371 /src/mod_register.erl
parentimproved SQL reconnect behaviour (diff)
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
Diffstat (limited to 'src/mod_register.erl')
-rw-r--r--src/mod_register.erl24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/mod_register.erl b/src/mod_register.erl
index 1da55253c..2a6c7c20b 100644
--- a/src/mod_register.erl
+++ b/src/mod_register.erl
@@ -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;