Diff

core/stanza_router.lua @ 4862:d1cfdb137b03

stanza_router: Catch s2s stanzas to hosts we don't serve earlier, and close with host-unknown (thanks darkrain)
author Matthew Wild <mwild1@gmail.com>
date Sat, 12 May 2012 00:31:48 +0100
parent 4817:9cc1d3e49f19
child 4863:8974a9b7363f
line wrap: on
line diff
--- a/core/stanza_router.lua	Fri May 11 23:20:58 2012 +0100
+++ b/core/stanza_router.lua	Sat May 12 00:31:48 2012 +0100
@@ -110,6 +110,10 @@
 			if not host_status or not host_status.authed then -- remote server trying to impersonate some other server?
 				log("warn", "Received a stanza claiming to be from %s, over a stream authed for %s!", from_host, origin.from_host);
 				return; -- FIXME what should we do here? does this work with subdomains?
+			elseif not hosts[to_host] then
+				log("warn", "Remote server %s sent us a stanza for %s, closing stream", origin.from_host, to_host);
+				origin:close("host-unknown");
+				return;
 			end
 		end
 		core_post_stanza(origin, stanza, origin.full_jid);