aboutsummaryrefslogtreecommitdiffstats
path: root/core/stanza_router.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-03-30 01:57:51 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-03-30 01:57:51 +0500
commit0f9fd252f66c66629d1e59720750a972e5945cf5 (patch)
tree6531d535905895f82d154ab0ffc50a695ff034eb /core/stanza_router.lua
parent9357b3fc3e70223a8a621e0d6f31b25693395c92 (diff)
downloadprosody-0f9fd252f66c66629d1e59720750a972e5945cf5.tar.gz
prosody-0f9fd252f66c66629d1e59720750a972e5945cf5.zip
Fixed: stanza_router: Respond with correct stanza error on malformed stanzas
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r--core/stanza_router.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index ef973ba2..bbbb6385 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -51,9 +51,11 @@ function core_process_stanza(origin, stanza)
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