24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

mod_register Access now also controls account unregistrations

This commit is contained in:
Badlop 2011-04-26 22:55:04 +02:00
parent 3952888f94
commit 4f4c8eb61e
2 changed files with 9 additions and 6 deletions

View File

@ -3820,10 +3820,11 @@ enables end users to use a \XMPP{} client to:
Options: Options:
\begin{description} \begin{description}
\titem{\{access, AccessName\}} \ind{options!access}This option can be configured to specify \titem{\{access, AccessName\}} \ind{options!access}
rules to restrict registration. If a rule returns `deny' on the requested Specify rules to restrict what usernames can be registered and unregistered.
user name, registration for that user name is denied. (there are no If a rule returns `deny' on the requested username,
restrictions by default). registration and unregistration of that user name is denied.
There are no restrictions by default.
\titem{\{access\_from, AccessName\}} \ind{options!access\_from}By default, \ejabberd{} \titem{\{access\_from, AccessName\}} \ind{options!access\_from}By default, \ejabberd{}
doesn't allow to register new accounts from s2s or existing c2s sessions. You can doesn't allow to register new accounts from s2s or existing c2s sessions. You can
change it by defining access rule in this option. Use with care: allowing registration change it by defining access rule in this option. Use with care: allowing registration

View File

@ -106,8 +106,10 @@ process_iq(From, To,
PTag = xml:get_subtag(SubEl, "password"), PTag = xml:get_subtag(SubEl, "password"),
RTag = xml:get_subtag(SubEl, "remove"), RTag = xml:get_subtag(SubEl, "remove"),
Server = To#jid.lserver, Server = To#jid.lserver,
Access = gen_mod:get_module_opt(Server, ?MODULE, access, all),
AllowRemove = (allow == acl:match_rule(Server, Access, From)),
if if
(UTag /= false) and (RTag /= false) -> (UTag /= false) and (RTag /= false) and AllowRemove ->
User = xml:get_tag_cdata(UTag), User = xml:get_tag_cdata(UTag),
case From of case From of
#jid{user = User, lserver = Server} -> #jid{user = User, lserver = Server} ->
@ -148,7 +150,7 @@ process_iq(From, To,
sub_el = [SubEl, ?ERR_BAD_REQUEST]} sub_el = [SubEl, ?ERR_BAD_REQUEST]}
end end
end; end;
(UTag == false) and (RTag /= false) -> (UTag == false) and (RTag /= false) and AllowRemove ->
case From of case From of
#jid{user = User, #jid{user = User,
lserver = Server, lserver = Server,