# HG changeset patch # User Kim Alvefur # Date 1480046889 -3600 # Node ID 26a7186a40c6b62fa164aca68745cdac9b827428 # Parent 0356216c474caf6e460e135b6385937f0fa4b6b5 core.stanza_router: Separate iq type check from child count check diff -r 0356216c474c -r 26a7186a40c6 core/stanza_router.lua --- a/core/stanza_router.lua Fri Nov 25 05:06:13 2016 +0100 +++ b/core/stanza_router.lua Fri Nov 25 05:08:09 2016 +0100 @@ -67,12 +67,15 @@ return handle_unhandled_stanza(origin.host, origin, stanza); end if name == "iq" then - if not iq_types[st_type] or ((st_type == "set" or st_type == "get") and (#stanza.tags ~= 1)) then - origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children")); + if not iq_types[st_type] then + origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type")); return; elseif not stanza.attr.id then origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing required 'id' attribute")); return; + elseif (st_type == "set" or st_type == "get") and (#stanza.tags ~= 1) then + origin.send(st.error_reply(stanza, "modify", "bad-request", "Incorrect number of children for IQ stanz")); + return; end end