callerid: scrub a departed/renamed nick from ACCEPT lists so it can't be reused to bypass +g
This commit is contained in:
parent
c1b7ed6dda
commit
8ed2003546
2 changed files with 18 additions and 0 deletions
12
src/users.rs
12
src/users.rs
|
|
@ -460,6 +460,18 @@ impl Server {
|
|||
u.nick = newnick.to_string();
|
||||
u.nick_ts = crate::server::now();
|
||||
}
|
||||
// Keep +g callerid ACCEPT lists in step: move the entry from the old nick to
|
||||
// the new one, so the freed old nick can't be grabbed to bypass someone's gate.
|
||||
let (oldlow, newlow) = (old.to_ascii_lowercase(), newnick.to_ascii_lowercase());
|
||||
if !old.is_empty() && oldlow != newlow {
|
||||
for u in self.users.values_mut() {
|
||||
for n in u.accept.iter_mut() {
|
||||
if *n == oldlow {
|
||||
*n = newlow.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if registered {
|
||||
let line = format!(":{prefix} NICK :{newnick}");
|
||||
let mut targets: HashSet<Uid> = HashSet::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue