Software / code / prosody
Comparison
core/stanza_router.lua @ 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 |
| parent | 898:8176d224208a |
| child | 966:d2692d427496 |
comparison
equal
deleted
inserted
replaced
| 923:c63f9bc45a85 | 924:db022135aed4 |
|---|---|
| 49 function core_process_stanza(origin, stanza) | 49 function core_process_stanza(origin, stanza) |
| 50 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag()) | 50 (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag()) |
| 51 | 51 |
| 52 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling. | 52 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling. |
| 53 -- TODO verify validity of stanza (as well as JID validity) | 53 -- TODO verify validity of stanza (as well as JID validity) |
| 54 if stanza.name == "iq" and #stanza.tags > 1 then | 54 if stanza.attr.xmlns == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log |
| 55 if stanza.attr.type == "set" or stanza.attr.type == "get" then | 55 if stanza.name == "iq" then |
| 56 error("Invalid IQ"); | 56 if (stanza.attr.type == "set" or stanza.attr.type == "get") and #stanza.tags ~= 1 then |
| 57 origin.send(st.error_reply(stanza, "modify", "bad-request")); | |
| 58 return; | |
| 57 end | 59 end |
| 58 end | 60 end |
| 59 | 61 |
| 60 if origin.type == "c2s" and not origin.full_jid | 62 if origin.type == "c2s" and not origin.full_jid |
| 61 and not(stanza.name == "iq" and stanza.tags[1].name == "bind" | 63 and not(stanza.name == "iq" and stanza.tags[1].name == "bind" |