4 -- |
4 -- |
5 -- This project is MIT/X11 licensed. Please see the |
5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. |
6 -- COPYING file in the source package for more information. |
7 -- |
7 -- |
8 |
8 |
9 local hosts = _G.hosts; |
|
10 local new_xmpp_stream = require "util.xmppstream".new; |
9 local new_xmpp_stream = require "util.xmppstream".new; |
11 local sm = require "core.sessionmanager"; |
10 local sm = require "core.sessionmanager"; |
12 local sm_destroy_session = sm.destroy_session; |
11 local sm_destroy_session = sm.destroy_session; |
13 local new_uuid = require "util.uuid".generate; |
12 local new_uuid = require "util.uuid".generate; |
14 local core_process_stanza = prosody.core_process_stanza; |
13 local core_process_stanza = prosody.core_process_stanza; |
281 log("debug", "BOSH client tried to connect to invalid host: %s", tostring(attr.to)); |
280 log("debug", "BOSH client tried to connect to invalid host: %s", tostring(attr.to)); |
282 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
281 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
283 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); |
282 ["xmlns:stream"] = xmlns_streams, condition = "improper-addressing" }); |
284 response:send(tostring(close_reply)); |
283 response:send(tostring(close_reply)); |
285 return; |
284 return; |
286 elseif not hosts[to_host] then |
285 elseif to_host ~= module.host then |
287 -- Unknown host |
286 -- Unknown host |
288 log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to)); |
287 log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to)); |
289 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
288 local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate", |
290 ["xmlns:stream"] = xmlns_streams, condition = "host-unknown" }); |
289 ["xmlns:stream"] = xmlns_streams, condition = "host-unknown" }); |
291 response:send(tostring(close_reply)); |
290 response:send(tostring(close_reply)); |