# HG changeset patch # User Goffi # Date 1583083786 -3600 # Node ID f4a28767ec3517b7c11a1e39a3ee1c8f6a96ad1e # Parent adf1aeaa0d3775830578305542481719996785c9 core (xmpp): check that entity_jid is actually a jid in SatRosterProtocol.isJidInRoster diff -r adf1aeaa0d37 -r f4a28767ec35 sat/core/xmpp.py --- a/sat/core/xmpp.py Sat Feb 29 16:55:22 2020 +0100 +++ b/sat/core/xmpp.py Sun Mar 01 18:29:46 2020 +0100 @@ -1010,6 +1010,10 @@ xmppim.MessageProtocol.__init__(self) self.host = host + @property + def client(self): + return self.parent + def parseMessage(self, message_elt): """Parse a message XML and return message_data @@ -1141,6 +1145,7 @@ media_type = mimetypes.guess_type(attachment['name'], strict=False)[0] if media_type: attachment[C.MESS_KEY_ATTACHMENTS_MEDIA_TYPE] = media_type + return data def skipEmptyMessage(self, data): @@ -1431,6 +1436,9 @@ def isJidInRoster(self, entity_jid): """Return True if jid is in roster""" + if not isinstance(entity_jid, jid.JID): + raise exceptions.InternalError( + f"a JID is expected, not {type(entity_jid)}: {entity_jid!r}") return entity_jid in self._jids def isPresenceAuthorised(self, entity_jid):