Changeset

4864:b98154bbe0e0

stanza_router: Close stream for unhandled stanzas from unauthenticated connections (we can't reply)
author Matthew Wild <mwild1@gmail.com>
date Sat, 12 May 2012 01:47:53 +0100
parents 4863:8974a9b7363f
children 4865:9171dc2357e0
files core/stanza_router.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/stanza_router.lua	Sat May 12 00:33:04 2012 +0100
+++ b/core/stanza_router.lua	Sat May 12 01:47:53 2012 +0100
@@ -28,13 +28,13 @@
 			return true;
 		end
 	end
-	if stanza.attr.xmlns == nil then
+	if stanza.attr.xmlns == nil and origin.send then
 		log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it
 		if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
 			origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
 		end
 	elseif not((name == "features" or name == "error") and xmlns == "http://etherx.jabber.org/streams") then -- FIXME remove check once we handle S2S features
-		log("warn", "Unhandled %s stream element: %s; xmlns=%s: %s", origin.type, stanza.name, xmlns, tostring(stanza)); -- we didn't handle it
+		log("warn", "Unhandled %s stream element or stanza: %s; xmlns=%s: %s", origin.type, stanza.name, xmlns, tostring(stanza)); -- we didn't handle it
 		origin:close("unsupported-stanza-type");
 	end
 end