# HG changeset patch # User Goffi # Date 1653748933 -7200 # Node ID 7d6ae8bb95dcb65ac5ba4285930f8e245cbfadfa # Parent bc8832c6696be07ee466f001f0ba3750281d20ef 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 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 stanza and children (like element). diff -r bc8832c6696b -r 7d6ae8bb95dc mod_delegation/mod_delegation.lua --- 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