Software /
code /
prosody-modules
Changeset
4953:7d6ae8bb95dc
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).
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 28 May 2022 16:42:13 +0200 |
parents | 4938:bc8832c6696b |
children | 4954:e8a487c42b36 |
files | mod_delegation/mod_delegation.lua |
diffstat | 1 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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