From 21b8508a0d4f6a2037f4300f04eb8d93ae23b9ec Mon Sep 17 00:00:00 2001 From: Marco Cirillo Date: Sun, 5 Sep 2021 00:59:18 +0200 Subject: [PATCH] mod_muc_limits: don't ever close a component stream. That'll kill the server. --- plugins/mod_muc_limits.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/mod_muc_limits.lua b/plugins/mod_muc_limits.lua index abb29ac0..148aaacb 100644 --- a/plugins/mod_muc_limits.lua +++ b/plugins/mod_muc_limits.lua @@ -79,12 +79,14 @@ local function handle_stanza(event) if stanza.attr.type == "error" then return true; end -- drop errors silently if trigger and trigger >= disconnect_after then room:set_role(true, occupant_jid, "none", nil, "Exceeded number of allowed throttled stanzas"); - origin:close{ condition = "policy-violation", text = "Exceeded number of allowed throttled stanzas" }; + if origin.type ~= "component" then + origin:close{ condition = "policy-violation", text = "Exceeded number of allowed throttled stanzas" }; + end return true; end origin.muc_limits_trigger = (not trigger and 1) or trigger + 1; - if use_gate_guard then + if use_gate_guard and origin.type ~= "component" then module:fire_event("call-gate-guard", { origin = origin, from = from_jid, reason = "MUC Flooding/DoS", ban_time = gate_guard_time, hits = gate_guard_hits } );