mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Don't let privacy list prevent local roster update
This commit is contained in:
parent
5e4c547856
commit
b54e1e49ba
@ -646,35 +646,39 @@ route_probe_reply(_, _) ->
|
|||||||
process_presence_out(#{user := User, server := Server, lserver := LServer,
|
process_presence_out(#{user := User, server := Server, lserver := LServer,
|
||||||
jid := JID, lang := Lang, pres_a := PresA} = State,
|
jid := JID, lang := Lang, pres_a := PresA} = State,
|
||||||
#presence{from = From, to = To, type = Type} = Pres) ->
|
#presence{from = From, to = To, type = Type} = Pres) ->
|
||||||
LTo = jid:tolower(To),
|
if Type == subscribe; Type == subscribed;
|
||||||
case privacy_check_packet(State, Pres, out) of
|
Type == unsubscribe; Type == unsubscribed ->
|
||||||
deny ->
|
|
||||||
ErrText = <<"Your active privacy list has denied "
|
|
||||||
"the routing of this stanza.">>,
|
|
||||||
Err = xmpp:err_not_acceptable(ErrText, Lang),
|
|
||||||
send_error(State, Pres, Err);
|
|
||||||
allow when Type == subscribe; Type == subscribed;
|
|
||||||
Type == unsubscribe; Type == unsubscribed ->
|
|
||||||
Access = gen_mod:get_module_opt(LServer, mod_roster, access, all),
|
Access = gen_mod:get_module_opt(LServer, mod_roster, access, all),
|
||||||
MyBareJID = jid:remove_resource(JID),
|
MyBareJID = jid:remove_resource(JID),
|
||||||
case acl:match_rule(LServer, Access, MyBareJID) of
|
case acl:match_rule(LServer, Access, MyBareJID) of
|
||||||
deny ->
|
deny ->
|
||||||
ErrText = <<"Access denied by service policy">>,
|
AccessErrTxt = <<"Access denied by service policy">>,
|
||||||
Err = xmpp:err_forbidden(ErrText, Lang),
|
AccessErr = xmpp:err_forbidden(AccessErrTxt, Lang),
|
||||||
send_error(State, Pres, Err);
|
send_error(State, Pres, AccessErr);
|
||||||
allow ->
|
allow ->
|
||||||
ejabberd_hooks:run(roster_out_subscription,
|
ejabberd_hooks:run(roster_out_subscription,
|
||||||
LServer,
|
LServer,
|
||||||
[User, Server, To, Type]),
|
[User, Server, To, Type])
|
||||||
BareFrom = jid:remove_resource(From),
|
|
||||||
ejabberd_router:route(xmpp:set_from_to(Pres, BareFrom, To)),
|
|
||||||
State
|
|
||||||
end;
|
end;
|
||||||
|
true -> ok
|
||||||
|
end,
|
||||||
|
case privacy_check_packet(State, Pres, out) of
|
||||||
|
deny ->
|
||||||
|
PrivErrTxt = <<"Your active privacy list has denied "
|
||||||
|
"the routing of this stanza.">>,
|
||||||
|
PrivErr = xmpp:err_not_acceptable(PrivErrTxt, Lang),
|
||||||
|
send_error(State, Pres, PrivErr);
|
||||||
|
allow when Type == subscribe; Type == subscribed;
|
||||||
|
Type == unsubscribe; Type == unsubscribed ->
|
||||||
|
BareFrom = jid:remove_resource(From),
|
||||||
|
ejabberd_router:route(xmpp:set_from_to(Pres, BareFrom, To)),
|
||||||
|
State;
|
||||||
allow when Type == error; Type == probe ->
|
allow when Type == error; Type == probe ->
|
||||||
ejabberd_router:route(Pres),
|
ejabberd_router:route(Pres),
|
||||||
State;
|
State;
|
||||||
allow ->
|
allow ->
|
||||||
ejabberd_router:route(Pres),
|
ejabberd_router:route(Pres),
|
||||||
|
LTo = jid:tolower(To),
|
||||||
LBareTo = jid:remove_resource(LTo),
|
LBareTo = jid:remove_resource(LTo),
|
||||||
LBareFrom = jid:remove_resource(jid:tolower(From)),
|
LBareFrom = jid:remove_resource(jid:tolower(From)),
|
||||||
if LBareTo /= LBareFrom ->
|
if LBareTo /= LBareFrom ->
|
||||||
|
Loading…
Reference in New Issue
Block a user