# HG changeset patch # User Goffi # Date 1430667792 -7200 # Node ID 3938496cd4f83e58a6c1a0119356ef7df2dd17f8 # Parent 48be6e7efbe804322a0be3c88eeb6845d4ec84b6 mod_delegation: removed invalid error replies to iq result. diff -r 48be6e7efbe8 -r 3938496cd4f8 mod_delegation/mod_delegation.lua --- a/mod_delegation/mod_delegation.lua Sun May 03 17:27:37 2015 +0200 +++ b/mod_delegation/mod_delegation.lua Sun May 03 17:43:12 2015 +0200 @@ -155,7 +155,7 @@ -- this function manage iq results from the managing entity -- it do a couple of security check before sending the -- result to the managed entity - local session, stanza = event.origin, event.stanza + local stanza = event.stanza if stanza.attr.to ~= module.host then module:log("warn", 'forwarded stanza result has "to" attribute not addressed to current host, id conflict ?') return @@ -166,20 +166,20 @@ local delegation = stanza.tags[1] if #stanza ~= 1 or delegation.name ~= "delegation" or delegation.attr.xmlns ~= _DELEGATION_NS then - session.send(st.error_reply(stanza, 'modify', 'not-acceptable')) + module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) return true end local forwarded = delegation.tags[1] if #delegation ~= 1 or forwarded.name ~= "forwarded" or forwarded.attr.xmlns ~= _FORWARDED_NS then - session.send(st.error_reply(stanza, 'modify', 'not-acceptable')) + module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) return true end local iq = forwarded.tags[1] if #forwarded ~= 1 or iq.name ~= "iq" or #iq ~= 1 then - session.send(st.error_reply(stanza, 'modify', 'not-acceptable')) + module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) return true end @@ -189,7 +189,7 @@ if stanza.attr.from ~= ns_data.connected or iq.attr.type ~= "result" or iq.attr.id ~= original.attr.id or iq.attr.to ~= original.attr.from then - session.send(st.error_reply(stanza, 'auth', 'forbidden')) + module:log("warn", "ignoring forbidden iq result from managing entity %s, please check that the component is no trying to do something bad (stanza: %s)", stanza.attr.from, tostring(stanza)) module:send(st.error_reply(original, 'cancel', 'service-unavailable')) return true end