From 64a444e3a2d5998c53650e71d22b00d20b1b5e97 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 18 Jul 2021 09:08:04 +0200 Subject: mod_s2s: Guard against missing 'to' on incoming stream Given an incoming this line would have mistakenly reported the 'from' as the local host. Neither are technically required and may be missing, especially on connections used only for Dialback. Outgoing connections initiated by Prosody always have 'from_host' and 'to_host', so it is safer to check it this way. --- plugins/mod_s2s.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua index 9aaecd6e..d4b0ca60 100644 --- a/plugins/mod_s2s.lua +++ b/plugins/mod_s2s.lua @@ -614,7 +614,7 @@ local function session_close(session, reason, remote_reason, bounce_reason) end end - local this_host = session.direction == "incoming" and session.to_host or session.from_host + local this_host = session.direction == "outgoing" and session.from_host or session.to_host if reason then -- nil == no err, initiated by us, false == initiated by remote local stream_error; -- cgit v1.2.3