Cap FORBID and vhost LIST output so a huge list can't overflow the operator's receive queue
All checks were successful
CI / check (push) Successful in 5m25s

This commit is contained in:
Jean Chevronnet 2026-07-20 20:44:15 +00:00
parent 8b45d386c6
commit aa270e061e
No known key found for this signature in database
9 changed files with 24 additions and 8 deletions

View file

@ -45,9 +45,12 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
return;
}
ctx.notice(me, from.uid, "Registration bans:");
for f in &forbids {
for f in forbids.iter().take(echo_api::LIST_CAP) {
ctx.notice(me, from.uid, t!(ctx, " [{kind}] \x02{mask}\x02 by {setter} ({when}) — {reason}", kind = f.kind.wire(), mask = f.mask, setter = f.setter, when = human_time(f.ts), reason = f.reason));
}
if forbids.len() > echo_api::LIST_CAP {
ctx.notice(me, from.uid, t!(ctx, "… and \x02{more}\x02 more; showing the first {cap}.", more = forbids.len() - echo_api::LIST_CAP, cap = echo_api::LIST_CAP));
}
}
_ => ctx.notice(me, from.uid, "Syntax: FORBID ADD <NICK|CHAN|EMAIL> <mask> <reason> | DEL <NICK|CHAN|EMAIL> <mask> | LIST"),
}