Software /
code /
prosody
Changeset
1899:ccb7d9ccbf24
stanza_router: Reply to IQ requests with missing 'id' attribute with a bad-request error.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Sun, 04 Oct 2009 21:46:35 +0500 |
parents | 1898:1ce02e2f5a3f |
children | 1900:93a94ec05ebe 1917:ac5fca9ef6fe |
files | core/stanza_router.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/core/stanza_router.lua Sun Oct 04 21:34:17 2009 +0500 +++ b/core/stanza_router.lua Sun Oct 04 21:46:35 2009 +0500 @@ -26,9 +26,13 @@ -- 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