Changeset

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
parents 4861:2ee71fa500d6
children 4863:8974a9b7363f
files core/stanza_router.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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);