aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_bosh.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-02 15:29:13 +0100
committerKim Alvefur <zash@zash.se>2019-11-02 15:29:13 +0100
commit6164878eb1f3b5b72b0cc3803e6e6b5d7b3a9309 (patch)
tree3b08ba97db4b4863d3558b7eea217856de097e32 /plugins/mod_bosh.lua
parentc66adb1b89d584c2ca07579c81e54043a3193a18 (diff)
downloadprosody-6164878eb1f3b5b72b0cc3803e6e6b5d7b3a9309.tar.gz
prosody-6164878eb1f3b5b72b0cc3803e6e6b5d7b3a9309.zip
mod_bosh: Abort early if request is missing hostname
Prevents traceback from passing nil to nameprep()
Diffstat (limited to 'plugins/mod_bosh.lua')
-rw-r--r--plugins/mod_bosh.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index f4d7eba2..b45a9dc2 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -272,6 +272,15 @@ function stream_callbacks.streamopened(context, attr)
-- New session request
context.notopen = nil; -- Signals that we accept this opening tag
+ if not attr.to then
+ log("debug", "BOSH client tried to connect without specifying a host");
+ report_bad_host();
+ local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+ ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" });
+ response:send(tostring(close_reply));
+ return;
+ end
+
local to_host = nameprep(attr.to);
local wait = tonumber(attr.wait);
if not to_host then