aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-10-04 21:46:35 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-10-04 21:46:35 +0500
commit269a562f52e2d404c4d49122436029d07d17711c (patch)
tree28bdf1c1c6425643598764c971719d2457a00403 /core/stanza_router.lua
parent53295e052d0b5fde8f2d94cb8f41427876c82935 (diff)
downloadprosody-269a562f52e2d404c4d49122436029d07d17711c.tar.gz
prosody-269a562f52e2d404c4d49122436029d07d17711c.zip
stanza_router: Reply to IQ requests with missing 'id' attribute with a bad-request error.
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index dac098bb..610498aa 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -26,9 +26,13 @@ function core_process_stanza(origin, stanza)
-- TODO verify validity of stanza (as well as JID validity)
if stanza.attr.type == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log
if stanza.name == "iq" then
- if (stanza.attr.type == "set" or stanza.attr.type == "get") and #stanza.tags ~= 1 then
+ local can_reply = stanza.attr.type == "set" or stanza.attr.type == "get"
+ local missing_id = not stanza.attr.id;
+ if can_reply and (#stanza.tags ~= 1 or missing_id) then
origin.send(st.error_reply(stanza, "modify", "bad-request"));
return;
+ elseif missing_id then
+ return;
end
end