Comparison

core/stanza_router.lua @ 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
parent 4863:8974a9b7363f
child 4867:b4219d987d05
comparison
equal deleted inserted replaced
4863:8974a9b7363f 4864:b98154bbe0e0
26 else 26 else
27 log("debug", "Discarding %s from %s of type: %s", name, origin_type, stanza.attr.type); 27 log("debug", "Discarding %s from %s of type: %s", name, origin_type, stanza.attr.type);
28 return true; 28 return true;
29 end 29 end
30 end 30 end
31 if stanza.attr.xmlns == nil then 31 if stanza.attr.xmlns == nil and origin.send then
32 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it 32 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it
33 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then 33 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
34 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); 34 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
35 end 35 end
36 elseif not((name == "features" or name == "error") and xmlns == "http://etherx.jabber.org/streams") then -- FIXME remove check once we handle S2S features 36 elseif not((name == "features" or name == "error") and xmlns == "http://etherx.jabber.org/streams") then -- FIXME remove check once we handle S2S features
37 log("warn", "Unhandled %s stream element: %s; xmlns=%s: %s", origin.type, stanza.name, xmlns, tostring(stanza)); -- we didn't handle it 37 log("warn", "Unhandled %s stream element or stanza: %s; xmlns=%s: %s", origin.type, stanza.name, xmlns, tostring(stanza)); -- we didn't handle it
38 origin:close("unsupported-stanza-type"); 38 origin:close("unsupported-stanza-type");
39 end 39 end
40 end 40 end
41 41
42 local iq_types = { set=true, get=true, result=true, error=true }; 42 local iq_types = { set=true, get=true, result=true, error=true };