Software /
code /
prosody-modules
Diff
mod_delegation/mod_delegation.lua @ 1724:2440a75e868f
mod_delegation: managing_ent_* now stop event propagation + forwarded <iq/> xmlns check
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 07 May 2015 22:40:58 +0200 |
parent | 1723:ef85c42ad977 |
child | 1774:7bfc23b2c038 |
line wrap: on
line diff
--- a/mod_delegation/mod_delegation.lua Mon May 04 18:44:00 2015 +0200 +++ b/mod_delegation/mod_delegation.lua Thu May 07 22:40:58 2015 +0200 @@ -184,6 +184,7 @@ local iq = forwarded.tags[1] if #forwarded ~= 1 or iq.name ~= "iq" or + iq.attr.xmlns ~= 'jabber:client' or (iq.attr.type =='result' and #iq ~= 1) or (iq.attr.type == 'error' and #iq > 2) then module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) @@ -191,6 +192,8 @@ return true end + iq.attr.xmlns = nil + local original = stanza_cache[stanza.attr.from][stanza.attr.id] stanza_cache[stanza.attr.from][stanza.attr.id] = nil -- we get namespace from original and not iq @@ -208,6 +211,7 @@ -- at this point eveything is checked, -- and we (hopefully) can send the the result safely module:send(iq) + return true end function managing_ent_error(event) @@ -222,6 +226,7 @@ stanza_cache[stanza.attr.from][stanza.attr.id] = nil module:log("warn", "Got an error after forwarding stanza to "..stanza.attr.from) module:send(st.error_reply(original, 'cancel', 'service-unavailable')) + return true end local function forward_iq(stanza, ns_data)