26
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-28 17:38:54 +01:00

Convert acl to exmpp.

SVN Revision: 1398
This commit is contained in:
Jean-Sébastien Pédron 2008-07-01 09:41:32 +00:00
parent f55274c7fb
commit ffbf8d5faa
4 changed files with 11 additions and 11 deletions

View File

@ -18,6 +18,11 @@
calling ejabberd_sm:set_presence/7. Don't convert broadcast children,
because it's an internal special element.
* src/acl.erl: Convert to exmpp.
* src/ejabberd_c2s.erl, src/ejabberd_s2s_in.erl: acl doesn't require
conversion anymore.
2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/Makefile.in: Remove the -I flag for exmpp includes; the

View File

@ -87,7 +87,7 @@ add_list(Host, ACLs, Clear) ->
end.
normalize(A) ->
jlib:nodeprep(A).
exmpp_stringprep:nodeprep(A).
normalize_spec({A, B}) ->
{A, normalize(B)};
normalize_spec({A, B, C}) ->
@ -158,7 +158,7 @@ match_acl(ACL, JID, Host) ->
all -> true;
none -> false;
_ ->
{User, Server, Resource} = jlib:jid_tolower(JID),
{User, Server, Resource} = jlib:short_jid(JID),
lists:any(fun(#acl{aclspec = Spec}) ->
case Spec of
all ->

View File

@ -392,10 +392,8 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
{auth, _ID, set, {U, P, D, R}} ->
try
JID = exmpp_jid:make_jid(U, StateData#state.server, R),
% XXX OLD FORMAT: JID.
JIDOld = jlib:to_old_jid(JID),
case acl:match_rule(StateData#state.server,
StateData#state.access, JIDOld) of
StateData#state.access, JID) of
allow ->
case ejabberd_auth:check_password_with_authmodule(
U, StateData#state.server, P,
@ -717,11 +715,9 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
U = StateData#state.user,
R = StateData#state.resource,
JID = StateData#state.jid,
% XXX OLD FORMAT: JID.
JIDOld = jlib:to_old_jid(JID),
true = exmpp_server_session:want_establishment(El),
case acl:match_rule(StateData#state.server,
StateData#state.access, JIDOld) of
StateData#state.access, JID) of
allow ->
?INFO_MSG("(~w) Opened session for ~s",
[StateData#state.socket,
@ -757,6 +753,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
privacy_list = PrivList});
_ ->
% XXX OLD FORMAT: Jid.
JIDOld = jlib:to_old_jid(JID),
ejabberd_hooks:run(forbidden_session_hook,
StateData#state.server, [JIDOld]),
?INFO_MSG("(~w) Forbidden session for ~s",

View File

@ -573,9 +573,7 @@ send_element(StateData, El) ->
change_shaper(StateData, Host, JID) ->
% XXX OLD FORMAT: JIDOld is an old #jid.
JIDOld = jlib:to_old_jid(JID),
Shaper = acl:match_rule(Host, StateData#state.shaper, JIDOld),
Shaper = acl:match_rule(Host, StateData#state.shaper, JID),
(StateData#state.sockmod):change_shaper(StateData#state.socket, Shaper).