Comparison

core/stanza_router.lua @ 7739:0356216c474c

core.stanza_router: Require 'id' attribute on iq stanzas (fixes #785)
author Kim Alvefur <zash@zash.se>
date Fri, 25 Nov 2016 05:06:13 +0100
parent 7648:d91ef1e6afc2
child 7740:26a7186a40c6
comparison
equal deleted inserted replaced
7738:0647b821e00a 7739:0356216c474c
68 end 68 end
69 if name == "iq" then 69 if name == "iq" then
70 if not iq_types[st_type] or ((st_type == "set" or st_type == "get") and (#stanza.tags ~= 1)) then 70 if not iq_types[st_type] or ((st_type == "set" or st_type == "get") and (#stanza.tags ~= 1)) then
71 origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children")); 71 origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children"));
72 return; 72 return;
73 elseif not stanza.attr.id then
74 origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing required 'id' attribute"));
75 return;
73 end 76 end
74 end 77 end
75 78
76 if not origin.full_jid 79 if not origin.full_jid
77 and not(name == "iq" and st_type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind" 80 and not(name == "iq" and st_type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind"