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