aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_s2s.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-18 09:08:04 +0200
committerKim Alvefur <zash@zash.se>2021-07-18 09:08:04 +0200
commit64a444e3a2d5998c53650e71d22b00d20b1b5e97 (patch)
treed35d64f02ebbd0ef9419afbcffb543d32297fe8d /plugins/mod_s2s.lua
parent5b7eea90c4b0c8fdc0f47e7ececf56065a2574ab (diff)
downloadprosody-64a444e3a2d5998c53650e71d22b00d20b1b5e97.tar.gz
prosody-64a444e3a2d5998c53650e71d22b00d20b1b5e97.zip
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.
Diffstat (limited to 'plugins/mod_s2s.lua')
-rw-r--r--plugins/mod_s2s.lua2
1 files changed, 1 insertions, 1 deletions
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;