]> granicus.if.org Git - ejabberd/commitdiff
mod_caps: Only store CAPS if contact is subscribed
authorHolger Weiss <holger@zedat.fu-berlin.de>
Mon, 29 Jan 2018 00:07:38 +0000 (01:07 +0100)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Mon, 29 Jan 2018 00:07:38 +0000 (01:07 +0100)
If a user is subscribed to a contact but not vice versa, don't store the
contact's CAPS.  This makes sure no PEP items are leaked to the contact.

src/mod_caps.erl

index 946e2dd82c71322eafe92c8788eee8d34ece49cb..7e5d6a7b8ac6470a39785c260064dc2eb912c5a3 100644 (file)
@@ -209,7 +209,7 @@ c2s_presence_in(C2SState,
     ToSelf = (From#jid.luser == To#jid.luser)
               and (From#jid.lserver == To#jid.lserver),
     Insert = (Type == available)
-              and ((Subscription == both) or (Subscription == to) or ToSelf),
+              and ((Subscription == both) or (Subscription == from) or ToSelf),
     Delete = (Type == unavailable) or (Type == error),
     if Insert or Delete ->
           LFrom = jid:tolower(From),