Changeset

11704:0a8671f32424

mod_s2s: Guard against missing 'to' on incoming stream Given an incoming <stream:stream from="example.com"> 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.
author Kim Alvefur <zash@zash.se>
date Sun, 18 Jul 2021 09:08:04 +0200
parents 11703:e57c5d9c722c
children 11705:7132acfd287e
files plugins/mod_s2s.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s.lua	Sun Jul 18 08:53:37 2021 +0200
+++ b/plugins/mod_s2s.lua	Sun Jul 18 09:08:04 2021 +0200
@@ -614,7 +614,7 @@
 		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;