aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-11-25 05:08:09 +0100
committerKim Alvefur <zash@zash.se>2016-11-25 05:08:09 +0100
commite9f906c318d5023eab000fda2f317775db4aac32 (patch)
tree5966a7341ebcf4f6b55c844414c3e58cf9ed9a48 /core/stanza_router.lua
parentbeb660feeb0d38fc343de891fcd0ae7d98f9c093 (diff)
downloadprosody-e9f906c318d5023eab000fda2f317775db4aac32.tar.gz
prosody-e9f906c318d5023eab000fda2f317775db4aac32.zip
core.stanza_router: Separate iq type check from child count check
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 2fb480ee..af797f08 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -67,12 +67,15 @@ function core_process_stanza(origin, stanza)
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