25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

mod_register Access now also controls account unregistrations

This commit is contained in:
Badlop 2011-04-26 21:31:33 +02:00
parent 34fc5d82b3
commit 0c7ce8b7fe
2 changed files with 9 additions and 6 deletions

View File

@ -3838,10 +3838,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

@ -108,8 +108,10 @@ process_iq(From, To,
PTag = exmpp_xml:get_element(SubEl, 'password'), PTag = exmpp_xml:get_element(SubEl, 'password'),
RTag = exmpp_xml:get_element(SubEl, 'remove'), RTag = exmpp_xml:get_element(SubEl, 'remove'),
Server = exmpp_jid:prep_domain_as_list(To), Server = exmpp_jid:prep_domain_as_list(To),
Access = gen_mod:get_module_opt(Server, ?MODULE, access, all),
AllowRemove = (allow == acl:match_rule(Server, Access, From)),
if if
(UTag /= undefined) and (RTag /= undefined) -> (UTag /= undefined) and (RTag /= undefined) and AllowRemove ->
User = exmpp_xml:get_cdata_as_list(UTag), User = exmpp_xml:get_cdata_as_list(UTag),
case {exmpp_jid:node_as_list(From), exmpp_jid:prep_domain_as_list(From)} of case {exmpp_jid:node_as_list(From), exmpp_jid:prep_domain_as_list(From)} of
{User, Server} -> {User, Server} ->
@ -144,7 +146,7 @@ process_iq(From, To,
exmpp_iq:error(IQ_Rec, 'bad-request') exmpp_iq:error(IQ_Rec, 'bad-request')
end end
end; end;
(UTag == undefined) and (RTag /= undefined) -> (UTag == undefined) and (RTag /= undefined) and AllowRemove ->
case {exmpp_jid:node_as_list(From), case {exmpp_jid:node_as_list(From),
exmpp_jid:prep_domain_as_list(From), exmpp_jid:prep_domain_as_list(From),
exmpp_jid:resource_as_list(From)}of exmpp_jid:resource_as_list(From)}of