Skip to content

Commit

Permalink
mod_muc_limits: don't ever close a component stream.
Browse files Browse the repository at this point in the history
That'll kill the server.
  • Loading branch information
maranda committed Sep 4, 2021
1 parent 72dada9 commit 21b8508
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/mod_muc_limits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
);
Expand Down

0 comments on commit 21b8508

Please # to comment.