server: carry accepted_nicks count across a nick change — set_nick rewrites ACCEPT entries old->new in place (bypassing accept_add/remove) so the reverse count desynced; the count-gated quit scrub could then skip a reused nick, letting it inherit +g acceptance. move the count old->new (also fixes a slow map leak)

This commit is contained in:
Jean Chevronnet 2026-08-19 04:45:07 +00:00
parent 155e804779
commit 9eda8cbd4f

View file

@ -404,6 +404,13 @@ impl Server {
}
}
}
// carry the accepted-nick reverse count across the rename (the number of
// acceptors doesn't change when the accepted user renames), so the
// count-gated quit scrub stays correct — otherwise a reused old nick could
// inherit acceptance and bypass +g, and the old-nick count would leak.
if let Some(c) = self.accepted_nicks.remove(&oldlow) {
*self.accepted_nicks.entry(newlow.clone()).or_insert(0) += c;
}
}
if registered {
let line = format!(":{prefix} NICK :{newnick}");