Mercurial > libervia-backend
diff sat/core/xmpp.py @ 3197:f4a28767ec35
core (xmpp): check that entity_jid is actually a jid in SatRosterProtocol.isJidInRoster
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 01 Mar 2020 18:29:46 +0100 |
parents | adf1aeaa0d37 |
children | fee8e33e2b3f |
line wrap: on
line diff
--- 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):