Changeset

4954:e8a487c42b36

merge upstream
author Goffi <goffi@goffi.org>
date Sat, 28 May 2022 16:43:04 +0200
parents 4953:7d6ae8bb95dc (diff) 4952:ccce785f53e1 (current diff)
children 4955:537054999093
files
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_delegation/mod_delegation.lua	Sat May 28 15:03:05 2022 +0200
+++ b/mod_delegation/mod_delegation.lua	Sat May 28 16:43:04 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