Software /
code /
prosody
Changeset
924:db022135aed4
Fixed: stanza_router: Respond with correct stanza error on malformed stanzas
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Mon, 30 Mar 2009 01:57:51 +0500 |
parents | 923:c63f9bc45a85 |
children | 925:4861bcf0afa4 |
files | core/stanza_router.lua |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/core/stanza_router.lua Mon Mar 30 01:55:56 2009 +0500 +++ b/core/stanza_router.lua Mon Mar 30 01:57:51 2009 +0500 @@ -51,9 +51,11 @@ if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling. -- TODO verify validity of stanza (as well as JID validity) - if stanza.name == "iq" and #stanza.tags > 1 then - if stanza.attr.type == "set" or stanza.attr.type == "get" then - error("Invalid IQ"); + if stanza.attr.xmlns == "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 + origin.send(st.error_reply(stanza, "modify", "bad-request")); + return; end end