Comparison

core/stanza_router.lua @ 894:b61c3589cd7b

Don't reject some valid IQs. Thanks to elmex for spotting.
author Matthew Wild <mwild1@gmail.com>
date Sat, 14 Mar 2009 16:03:48 +0000
parent 854:b9cfc9d5496a
child 897:aeb05598dec1
comparison
equal deleted inserted replaced
886:96de7f0a41cc 894:b61c3589cd7b
49 function core_process_stanza(origin, stanza) 49 function core_process_stanza(origin, stanza)
50 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag()) 50 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag())
51 51
52 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling. 52 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling.
53 -- TODO verify validity of stanza (as well as JID validity) 53 -- TODO verify validity of stanza (as well as JID validity)
54 if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then 54 if stanza.name == "iq" and #stanza.tags > 1 then
55 if stanza.attr.type == "set" or stanza.attr.type == "get" then 55 if stanza.attr.type == "set" or stanza.attr.type == "get" then
56 error("Invalid IQ");
57 elseif #stanza.tags > 1 and not(stanza.attr.type == "error" or stanza.attr.type == "result") then
58 error("Invalid IQ"); 56 error("Invalid IQ");
59 end 57 end
60 end 58 end
61 59
62 if origin.type == "c2s" and not origin.full_jid 60 if origin.type == "c2s" and not origin.full_jid