aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_c2s.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-05-30 22:43:45 +0100
committerMatthew Wild <mwild1@gmail.com>2018-05-30 22:43:45 +0100
commit55969635f133580d9d47ef35b0c1de7ae10d48da (patch)
treeadd4eed8fa9089dd21a4452a6a097fbd86b55ab1 /plugins/mod_c2s.lua
parent5e4a7b6ffc7fadd01fd77233a9a4c32d2b373995 (diff)
parentb294f1695c9f638bfb17a97cf6fdae06bd5aed4b (diff)
downloadprosody-55969635f133580d9d47ef35b0c1de7ae10d48da.tar.gz
prosody-55969635f133580d9d47ef35b0c1de7ae10d48da.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_c2s.lua')
-rw-r--r--plugins/mod_c2s.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua
index b634b843..3816a262 100644
--- a/plugins/mod_c2s.lua
+++ b/plugins/mod_c2s.lua
@@ -56,12 +56,19 @@ local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
function stream_callbacks.streamopened(session, attr)
local send = session.send;
- session.host = nameprep(attr.to);
- if not session.host then
+ local host = nameprep(attr.to);
+ if not host then
session:close{ condition = "improper-addressing",
text = "A valid 'to' attribute is required on stream headers" };
return;
end
+ if not session.host then
+ session.host = host;
+ elseif session.host ~= host then
+ session:close{ condition = "not-authorized",
+ text = "The 'to' attribute must remain the same across stream restarts" };
+ return;
+ end
session.version = tonumber(attr.version) or 0;
session.streamid = uuid_generate();
(session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);