aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
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
commitfc5957ca423511b31830e8a610e218a6364a78e9 (patch)
tree3b08ba97db4b4863d3558b7eea217856de097e32 /plugins
parentcffb8bea9a82b514aec4ec3b479e055298c3c4bb (diff)
downloadprosody-fc5957ca423511b31830e8a610e218a6364a78e9.tar.gz
prosody-fc5957ca423511b31830e8a610e218a6364a78e9.zip
mod_bosh: Abort early if request is missing hostname
Prevents traceback from passing nil to nameprep()
Diffstat (limited to 'plugins')
-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