changeset 2714:57eac4fd0ec0

core (xmpp): check <message> namespace in parseMessage, and accept empty namespace (happen with Wokkel)
author Goffi <goffi@goffi.org>
date Fri, 07 Dec 2018 17:46:50 +0100
parents 19000c506d0c
children b35c84ea73cf
files sat/core/xmpp.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/xmpp.py	Fri Dec 07 17:43:43 2018 +0100
+++ b/sat/core/xmpp.py	Fri Dec 07 17:46:50 2018 +0100
@@ -839,6 +839,7 @@
 
 
 class SatMessageProtocol(xmppim.MessageProtocol):
+
     def __init__(self, host):
         xmppim.MessageProtocol.__init__(self)
         self.host = host
@@ -856,6 +857,15 @@
                 u"parseMessage used with a non <message/> stanza, ignoring: {xml}"
                 .format(xml=message_elt.toXml())))
             return {}
+
+        if message_elt.uri is None:
+            # wokkel element parsing strip out root namespace
+            message_elt.uri = C.NS_CLIENT
+        elif message_elt.uri != C.NS_CLIENT:
+            log.warning(_(
+                u"received <message> with a wrong namespace: {xml}"
+                .format(xml=message_elt.toXml())))
+
         client = self.parent
         message = {}
         subject = {}