diff options
Diffstat (limited to 'core/stanza_router.lua')
-rw-r--r-- | core/stanza_router.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua index dac098bb..e8ade0e1 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 @@ -110,7 +114,7 @@ function core_process_stanza(origin, stanza) end if h.events.fire_event(event, {origin = origin, stanza = stanza}) then return; end end - if host and not hosts[host] then host = nil; end -- workaround for a Pidgin bug which sets 'to' to the SRV result + if host and not hosts[host] then host = nil; end -- COMPAT: workaround for a Pidgin bug which sets 'to' to the SRV result modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); end end |