Changeset

4846:3bc3498df0a0

Merge with Maranda
author Matthew Wild <mwild1@gmail.com>
date Fri, 11 May 2012 01:53:32 +0100
parents 4834:878f75ccc4fb (current diff) 4845:f56eeff93847 (diff)
children 4847:7a7cc4d98faf
files plugins/mod_auth_anonymous.lua plugins/mod_dialback.lua
diffstat 2 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_dialback.lua	Fri May 11 00:56:18 2012 +0100
+++ b/plugins/mod_dialback.lua	Fri May 11 01:53:32 2012 +0100
@@ -15,6 +15,7 @@
 
 local st = require "util.stanza";
 local sha256_hash = require "util.hashes".sha256;
+local nameprep = require "util.encodings".stringprep.nameprep;
 
 local xmlns_stream = "http://etherx.jabber.org/streams";
 
@@ -79,8 +80,21 @@
 		
 		-- COMPAT: ejabberd, gmail and perhaps others do not always set 'to' and 'from'
 		-- on streams. We fill in the session's to/from here instead.
-		if not origin.from_host then origin.from_host = from; end
-		if not origin.to_host then origin.to_host = to;	end
+		if not origin.from_host then
+			origin.from_host = nameprep(attr.from);
+			if not origin.from_host then
+				origin.log("debug", "We need to know where to connect but remote server blindly refuses to tell us and to comply to specs, closing connection.");
+				origin:close("invalid-from");
+			end
+		end
+		if not origin.to_host then
+			origin.to_host = nameprep(attr.to);
+		end
+
+		if not origin.from_host and not origin.to_host then
+			origin.log("debug", "Improper addressing supplied, no to or from?");
+			origin:close("improper-addressing");
+		end
 		
 		origin.log("debug", "asking %s if key %s belongs to them", from, stanza[1]);
 		module:fire_event("route/remote", {
--- a/plugins/muc/muc.lib.lua	Fri May 11 00:56:18 2012 +0100
+++ b/plugins/muc/muc.lib.lua	Fri May 11 01:53:32 2012 +0100
@@ -744,7 +744,11 @@
 	local xmlns = stanza.tags[1] and stanza.tags[1].attr.xmlns;
 	if stanza.name == "iq" then
 		if xmlns == "http://jabber.org/protocol/disco#info" and type == "get" then
-			origin.send(self:get_disco_info(stanza));
+			if stanza.tags[1].attr.node then
+				origin.send(st.error_reply(stanza, "cancel", "feature-not-implemented"));
+			else
+				origin.send(self:get_disco_info(stanza));
+			end
 		elseif xmlns == "http://jabber.org/protocol/disco#items" and type == "get" then
 			origin.send(self:get_disco_items(stanza));
 		elseif xmlns == "http://jabber.org/protocol/muc#admin" then