mod_delegation: use clean_xmlns to remove jabber:client namespace from node:
for the same reason as in mod_privilege, `jabber:client` namespace is removed with the
clean_xmlns method coming from there.
Furthermore, the forwarded <iq> stanza use the `jabber:client` xmlns while the stanza may
come from a component with e.g. `jabber:component:accept` xmlns, this can lead to
inconsistencies between the <iq> stanza and children (like <error> element).
--- a/mod_delegation/mod_delegation.lua Wed May 11 12:44:32 2022 +0200
+++ b/mod_delegation/mod_delegation.lua Sat May 28 16:42:13 2022 +0200
@@ -170,6 +170,20 @@
local managing_ent_error
local stanza_cache = {} -- we cache original stanza to build reply
+local function clean_xmlns(node)
+ -- Recursively remove "jabber:client" attribute from node.
+ -- In Prosody internal routing, xmlns should not be set.
+ -- Keeping xmlns would lead to issues like mod_smacks ignoring the outgoing stanza,
+ -- so we remove all xmlns attributes with a value of "jabber:client"
+ -- note: this function comes from mod_privilege
+ if node.attr.xmlns == 'jabber:client' then
+ for childnode in node:childtags() do
+ clean_xmlns(childnode)
+ end
+ node.attr.xmlns = nil
+ end
+end
+
local function managing_ent_result(event)
-- this function manage iq results from the managing entity
-- it do a couple of security check before sending the
@@ -209,7 +223,7 @@
return true
end
- iq.attr.xmlns = nil
+ clean_xmlns(iq)
local original = stanza_cache[stanza.attr.from][stanza.attr.id]
stanza_cache[stanza.attr.from][stanza.attr.id] = nil