core (xmpp): check <message> namespace in parseMessage, and accept empty namespace (happen with Wokkel)

This commit is contained in:
Goffi 2018-12-07 17:46:50 +01:00
commit 7e79203fa0

View file

@ -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 <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 = {}