aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-10-03 15:07:48 +0200
committerKim Alvefur <zash@zash.se>2020-10-03 15:07:48 +0200
commit504113c26ec239039eb7d86988cda1d6ebd2826b (patch)
tree69833ca91a6af3fbba14b9f5c257f28107d2420f /plugins
parent70a78c323a7c5ac7489afc3df873d609cf725eb5 (diff)
parent8f249009213d660a9884fb632530fb06d215e799 (diff)
downloadprosody-504113c26ec239039eb7d86988cda1d6ebd2826b.tar.gz
prosody-504113c26ec239039eb7d86988cda1d6ebd2826b.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_bosh.lua19
1 files changed, 18 insertions, 1 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index d4c1ac6a..c5f5e044 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -282,7 +282,6 @@ function stream_callbacks.streamopened(context, attr)
end
local to_host = nameprep(attr.to);
- local wait = tonumber(attr.wait);
if not to_host then
log("debug", "BOSH client tried to connect to invalid host: %s", attr.to);
report_bad_host();
@@ -291,6 +290,24 @@ function stream_callbacks.streamopened(context, attr)
response:send(tostring(close_reply));
return;
end
+
+ if not prosody.hosts[to_host] then
+ log("debug", "BOSH client tried to connect to non-existant host: %s", attr.to);
+ 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
+
+ if prosody.hosts[to_host].type ~= "local" then
+ log("debug", "BOSH client tried to connect to %s host: %s", prosody.hosts[to_host].type, attr.to);
+ 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 wait = tonumber(attr.wait);
if not rid or (not attr.wait or not wait or wait < 0 or wait % 1 ~= 0) then
log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", attr.rid, attr.wait);
local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",