From 7e79203fa0bdc8f3253fdca5d0880391d8641eba Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 7 Dec 2018 17:46:50 +0100 Subject: [PATCH] core (xmpp): check namespace in parseMessage, and accept empty namespace (happen with Wokkel) --- sat/core/xmpp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index a68fa681..b2f44fbf 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -839,6 +839,7 @@ class SatXMPPComponent(SatXMPPEntity, component.Component): class SatMessageProtocol(xmppim.MessageProtocol): + def __init__(self, host): xmppim.MessageProtocol.__init__(self) self.host = host @@ -856,6 +857,15 @@ class SatMessageProtocol(xmppim.MessageProtocol): u"parseMessage used with a non 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 with a wrong namespace: {xml}" + .format(xml=message_elt.toXml()))) + client = self.parent message = {} subject = {}