Merge 0.9->0.10 0.10.2
authorMatthew Wild <mwild1@gmail.com>
Wed, 30 May 2018 21:55:09 +0100
changeset 8849 7ec098b68042
parent 8845 463505cc75d5 (current diff)
parent 8848 c6b45cac9423 (diff)
child 8850 74526c425dec
child 8883 9e565d0b1771
Merge 0.9->0.10
.hgtags
plugins/mod_c2s.lua
--- a/.hgtags	Wed May 30 21:33:53 2018 +0100
+++ b/.hgtags	Wed May 30 21:55:09 2018 +0100
@@ -63,3 +63,4 @@
 39966cbc29f46d7ae9660edca8683d5121c82edf 0.10.0
 082d127286451eb55420c36424dd321e8d9bceee 0.9.13
 4ae8dd415e9431924ad4aa0b57bcee8a4a9272f8 0.10.1
+29c6d2681bad9f67d8bd548bb3a7973473bae91e 0.9.14
--- a/plugins/mod_c2s.lua	Wed May 30 21:33:53 2018 +0100
+++ b/plugins/mod_c2s.lua	Wed May 30 21:55:09 2018 +0100
@@ -49,12 +49,19 @@
 
 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);