diff options
author | Kim Alvefur <zash@zash.se> | 2019-11-02 15:43:17 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-11-02 15:43:17 +0100 |
commit | b24814cbe469216a4321635a48e3f9077d313f49 (patch) | |
tree | b29e138c1323789a1f99439703b2b1847cfadccb | |
parent | fd7ac7b72e6337637c7d02ab5858067357be542d (diff) | |
download | prosody-b24814cbe469216a4321635a48e3f9077d313f49.tar.gz prosody-b24814cbe469216a4321635a48e3f9077d313f49.zip |
mod_s2s: Only nameprep stream to/from addresses if they are present
Prevents traceback from nameprep(nil)
-rw-r--r-- | plugins/mod_s2s/mod_s2s.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua index b9c13ef2..42998c30 100644 --- a/plugins/mod_s2s/mod_s2s.lua +++ b/plugins/mod_s2s/mod_s2s.lua @@ -327,7 +327,9 @@ function stream_callbacks._streamopened(session, attr) -- 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; |