mod_s2s: Only nameprep stream to/from addresses if they are present
authorKim Alvefur <zash@zash.se>
Sat, 02 Nov 2019 15:43:17 +0100
changeset 10385 66fa45d24481
parent 10384 18685a5e362e
child 10386 fcdc65bc6697
mod_s2s: Only nameprep stream to/from addresses if they are present Prevents traceback from nameprep(nil)
plugins/mod_s2s/mod_s2s.lua
--- a/plugins/mod_s2s/mod_s2s.lua	Sat Nov 02 15:40:20 2019 +0100
+++ b/plugins/mod_s2s/mod_s2s.lua	Sat Nov 02 15:43:17 2019 +0100
@@ -327,7 +327,9 @@
 		-- Send a reply stream header
 
 		-- Validate to/from
-		local to, from = nameprep(attr.to), nameprep(attr.from);
+		local to, from = attr.to, attr.from;
+		if to then to = nameprep(attr.to); end
+		if from then from = nameprep(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;