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

@ -11,8 +11,11 @@ pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
return;
}
ctx.notice(me, from.uid, t!(ctx, "Assigned vhosts ({count}):", count = vhosts.len()));
for v in &vhosts {
for v in vhosts.iter().take(echo_api::LIST_CAP) {
let temp = if v.expires.is_some() { t!(ctx, ", temporary") } else { String::new() };
ctx.notice(me, from.uid, t!(ctx, " \x02{account}\x02 — {host} (by {setter}{temp})", account = v.account, host = v.host, setter = v.setter, temp = temp));
}
if vhosts.len() > echo_api::LIST_CAP {
ctx.notice(me, from.uid, t!(ctx, "… and \x02{more}\x02 more; showing the first {cap}.", more = vhosts.len() - echo_api::LIST_CAP, cap = echo_api::LIST_CAP));
}
}