mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
prevent pubsub filtering too much packets
This commit is contained in:
parent
75053cf40d
commit
a67539075f
@ -3981,20 +3981,22 @@ feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
||||
%% Else, the message comes from PEP
|
||||
_ ->
|
||||
case exmpp_xml:get_element(El, 'event') of
|
||||
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
||||
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
||||
Feature = exmpp_xml:get_attribute_as_list(Items, "node", ""),
|
||||
case is_feature_supported(Pres, Feature) of
|
||||
true -> allow;
|
||||
false -> deny
|
||||
end;
|
||||
_ ->
|
||||
allow
|
||||
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
||||
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
||||
Feature = exmpp_xml:get_attribute_as_list(Items, "node", ""),
|
||||
case is_feature_supported(Pres, Feature) of
|
||||
true -> allow;
|
||||
false -> deny
|
||||
end;
|
||||
_ ->
|
||||
allow
|
||||
end
|
||||
end;
|
||||
feature_check_packet(Acc, _User, _Server, _Pres, _Packet, _Direction) ->
|
||||
Acc.
|
||||
|
||||
is_feature_supported(_, []) ->
|
||||
true;
|
||||
is_feature_supported(#xmlel{name = 'presence', children = Els}, Feature) ->
|
||||
case mod_caps:read_caps(Els) of
|
||||
nothing -> false;
|
||||
|
@ -3759,8 +3759,8 @@ odbc_conn(Host) ->
|
||||
lists:dropwhile(fun(A) -> A/=$. end, Host) -- ".".
|
||||
|
||||
%% escape value for database storage
|
||||
escape({U, H, R})->
|
||||
ejabberd_odbc:escape(exmpp_jid:to_list(U, H, R));
|
||||
escape({_U, _H, _R}=JID)->
|
||||
ejabberd_odbc:escape(exmpp_jid:to_list(JID));
|
||||
escape(Value)->
|
||||
ejabberd_odbc:escape(Value).
|
||||
%%%% helpers
|
||||
@ -3853,20 +3853,22 @@ feature_check_packet(allow, _User, Server, Pres, {From, _To, El}, in) ->
|
||||
%% Else, the message comes from PEP
|
||||
_ ->
|
||||
case exmpp_xml:get_element(El, 'event') of
|
||||
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
||||
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
||||
Feature = exmpp_xml:get_attribute_as_list(Items, "node", ""),
|
||||
case is_feature_supported(Pres, Feature) of
|
||||
true -> allow;
|
||||
false -> deny
|
||||
end;
|
||||
_ ->
|
||||
allow
|
||||
#xmlel{name = 'event', ns = ?NS_PUBSUB_EVENT} = Event ->
|
||||
Items = exmpp_xml:get_element(Event, ?NS_PUBSUB_EVENT, 'items'),
|
||||
Feature = exmpp_xml:get_attribute_as_list(Items, "node", ""),
|
||||
case is_feature_supported(Pres, Feature) of
|
||||
true -> allow;
|
||||
false -> deny
|
||||
end;
|
||||
_ ->
|
||||
allow
|
||||
end
|
||||
end;
|
||||
feature_check_packet(Acc, _User, _Server, _Pres, _Packet, _Direction) ->
|
||||
Acc.
|
||||
|
||||
is_feature_supported(_, []) ->
|
||||
true;
|
||||
is_feature_supported(#xmlel{name = 'presence', children = Els}, Feature) ->
|
||||
case mod_caps:read_caps(Els) of
|
||||
nothing -> false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- mod_pubsub.erl 2010-06-02 16:46:29.000000000 +0200
|
||||
+++ mod_pubsub_odbc.erl 2010-06-02 16:46:33.000000000 +0200
|
||||
--- mod_pubsub.erl 2010-06-10 14:25:01.000000000 +0200
|
||||
+++ mod_pubsub_odbc.erl 2010-06-10 14:25:09.000000000 +0200
|
||||
@@ -42,7 +42,7 @@
|
||||
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
||||
%%% XEP-0060 section 12.18.
|
||||
|
Loading…
Reference in New Issue
Block a user