Changeset

178:8315cf03f304

Merge presence/subscription support from waqas
author Matthew Wild <mwild1@gmail.com>
date Sun, 26 Oct 2008 13:19:09 +0000
parents 169:92768120b717 (diff) 177:606c433955e7 (current diff)
children 179:774a172b03c8
files core/stanza_router.lua
diffstat 2 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/core/s2smanager.lua	Sun Oct 26 00:22:18 2008 +0500
+++ b/core/s2smanager.lua	Sun Oct 26 13:19:09 2008 +0000
@@ -111,11 +111,6 @@
 		print(session, session.from_host, "incoming s2s stream opened");
 		send("<?xml version='1.0'?>");
 		send(format("<stream:stream xmlns='jabber:server' xmlns:db='jabber:server:dialback' xmlns:stream='http://etherx.jabber.org/streams' id='%s' from='%s'>", session.streamid, session.to_host));
-		if session.from_host then
-			-- Need to perform dialback to check identity
-			print("to: "..tostring(attr.to).." from: "..tostring(attr.from));
-			print("Need to do dialback here you know!!");
-		end
 	elseif session.direction == "outgoing" then
 		-- If we are just using the connection for verifying dialback keys, we won't try and auth it
 		if not session.dialback_verifying then
@@ -180,7 +175,7 @@
 end
 
 function destroy_session(session)
-	(session.log or log)("info", "Destroying session");
+	(session.log or log)("info", "Destroying "..tostring(session.direction).." session "..tostring(session.from_host).."->"..tostring(session.to_host));
 	if session.direction == "outgoing" then
 		hosts[session.to_host] = nil;
 	end
--- a/core/stanza_router.lua	Sun Oct 26 00:22:18 2008 +0500
+++ b/core/stanza_router.lua	Sun Oct 26 13:19:09 2008 +0000
@@ -135,9 +135,12 @@
 				print(tostring(origin.to_host), tostring(origin.from_host))
 				-- FIXME: Grr, ejabberd breaks this one too?? it is black and white in XEP-220 example 34
 				--if attr.from ~= origin.to_host then error("invalid-from"); end
-				local type = "invalid";
+				local type;
 				if s2s_verify_dialback(attr.id, attr.from, attr.to, stanza[1]) then
 					type = "valid"
+				else
+					type = "invalid"
+					log("warn", "Asked to verify a dialback key that was incorrect. An imposter is claiming to be %s?", attr.to);
 				end
 				origin.send(format("<db:verify from='%s' to='%s' id='%s' type='%s'>%s</db:verify>", attr.to, attr.from, attr.id, type, stanza[1]));
 			elseif stanza.name == "result" and origin.type == "s2sin_unauthed" then