diff plugins/mod_s2s.lua @ 14106:b5eeb6730721

Merge 13.0->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 22 Mar 2026 11:28:52 +0100
parents e08e535a9945 a1fb05cbd44e
children c1469296190d
line wrap: on
line diff
--- a/plugins/mod_s2s.lua	Wed Mar 11 16:59:10 2026 +0100
+++ b/plugins/mod_s2s.lua	Sun Mar 22 11:28:52 2026 +0100
@@ -19,7 +19,7 @@
 local stop_timer = require "prosody.util.timer".stop;
 local st = require "prosody.util.stanza";
 local initialize_filters = require "prosody.util.filters".initialize;
-local nameprep = require "prosody.util.encodings".stringprep.nameprep;
+local prepped_split = require "prosody.util.jid".prepped_split;
 local new_xmpp_stream = require "prosody.util.xmppstream".new;
 local s2s_new_incoming = require "prosody.core.s2smanager".new_incoming;
 local s2s_new_outgoing = require "prosody.core.s2smanager".new_outgoing;
@@ -511,8 +511,12 @@
 
 		-- Validate to/from
 		local to, from = attr.to, attr.from;
-		if to then to = nameprep(attr.to); end
-		if from then from = nameprep(attr.from); end
+		local function hostprep(s)
+			local node, host, res = prepped_split(s);
+			if not (node or res) then return host; end
+		end
+		if to then to = hostprep(attr.to); end
+		if from then from = hostprep(attr.from); end
 		if not to and attr.to then -- COMPAT: Some servers do not reliably set 'to' (especially on stream restarts)
 			session:close({ condition = "improper-addressing", text = "Invalid 'to' address" });
 			return;