25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +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, calling ejabberd_sm:set_presence/7. Don't convert broadcast children,
because it's an internal special element. 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> 2008-06-30 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/Makefile.in: Remove the -I flag for exmpp includes; the * src/Makefile.in: Remove the -I flag for exmpp includes; the

View File

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

View File

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

View File

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