# HG changeset patch # User Matthew Wild # Date 1336783673 -3600 # Node ID b98154bbe0e01772b296bc26d55a744286b111a1 # Parent 8974a9b7363f86163bfbc8bc24f6cecc0f26c2f9 stanza_router: Close stream for unhandled stanzas from unauthenticated connections (we can't reply) diff -r 8974a9b7363f -r b98154bbe0e0 core/stanza_router.lua --- 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