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

Use acl:access_matches in c2s

This commit is contained in:
Paweł Chmielowski 2016-05-25 13:00:16 +02:00
parent 49658e1655
commit fffae97940

View File

@ -624,9 +624,9 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
{auth, _ID, set, {U, P, D, R}} -> {auth, _ID, set, {U, P, D, R}} ->
JID = jid:make(U, StateData#state.server, R), JID = jid:make(U, StateData#state.server, R),
case JID /= error andalso case JID /= error andalso
acl:match_rule(StateData#state.server, acl:access_matches(StateData#state.access,
StateData#state.access, JID) #{usr => jid:split(JID), ip => StateData#state.ip},
== allow StateData#state.server) == allow
of of
true -> true ->
DGen = fun (PW) -> DGen = fun (PW) ->
@ -1103,8 +1103,10 @@ open_session(StateData) ->
R = StateData#state.resource, R = StateData#state.resource,
JID = StateData#state.jid, JID = StateData#state.jid,
Lang = StateData#state.lang, Lang = StateData#state.lang,
case acl:match_rule(StateData#state.server, IP = StateData#state.ip,
StateData#state.access, JID) of case acl:access_matches(StateData#state.access,
#{usr => jid:split(JID), ip => IP},
StateData#state.server) of
allow -> allow ->
?INFO_MSG("(~w) Opened session for ~s", ?INFO_MSG("(~w) Opened session for ~s",
[StateData#state.socket, jid:to_string(JID)]), [StateData#state.socket, jid:to_string(JID)]),
@ -1824,8 +1826,9 @@ terminate(_Reason, StateName, StateData) ->
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
change_shaper(StateData, JID) -> change_shaper(StateData, JID) ->
Shaper = acl:match_rule(StateData#state.server, Shaper = acl:access_matches(StateData#state.shaper,
StateData#state.shaper, JID), #{usr => jid:split(JID), ip => StateData#state.ip},
StateData#state.server),
(StateData#state.sockmod):change_shaper(StateData#state.socket, (StateData#state.sockmod):change_shaper(StateData#state.socket,
Shaper). Shaper).