aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2015-06-19 00:50:08 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2015-06-19 00:50:08 +0200
commit04038c01f76fd36bcd8f6252d8f37254f1d2fbf7 (patch)
tree58dfaa2fe8a9d71a6ac905ba4dc9ed39acc09bf5
parentNew hide_sensitive_log_data option to hide client IP in log (#452 #471) (diff)
PubSub: Check for node subscription of bare JID
Don't just check whether the full JID is subscribed when a node subscription is required to list or publish items. If the bare JID is subscribed, these requests are now also accepted.
-rw-r--r--src/node_hometree.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/node_hometree.erl b/src/node_hometree.erl
index 296fbdde7..01eeccdd9 100644
--- a/src/node_hometree.erl
+++ b/src/node_hometree.erl
@@ -373,7 +373,8 @@ publish_item(Nidx, Publisher, PublishModel, MaxItems, ItemId, Payload) ->
end,
Affiliation = GenState#pubsub_state.affiliation,
Subscribed = case PublishModel of
- subscribers -> is_subscribed(SubState#pubsub_state.subscriptions);
+ subscribers -> is_subscribed(GenState#pubsub_state.subscriptions) orelse
+ is_subscribed(SubState#pubsub_state.subscriptions);
_ -> undefined
end,
if not ((PublishModel == open) or
@@ -738,8 +739,10 @@ get_items(Nidx, JID, AccessModel, PresenceSubscription, RosterGroup, _SubId, _RS
GenState = get_state(Nidx, GenKey),
SubState = get_state(Nidx, SubKey),
Affiliation = GenState#pubsub_state.affiliation,
- Subscriptions = SubState#pubsub_state.subscriptions,
- Whitelisted = can_fetch_item(Affiliation, Subscriptions),
+ BareSubscriptions = GenState#pubsub_state.subscriptions,
+ FullSubscriptions = SubState#pubsub_state.subscriptions,
+ Whitelisted = can_fetch_item(Affiliation, BareSubscriptions) orelse
+ can_fetch_item(Affiliation, FullSubscriptions),
if %%SubId == "", ?? ->
%% Entity has multiple subscriptions to the node but does not specify a subscription ID
%{error, ?ERR_EXTENDED(?ERR_BAD_REQUEST, "subid-required")};