engine: apply gossiped network bans to the ircd immediately
All checks were successful
CI / check (push) Successful in 3m47s
All checks were successful
CI / check (push) Successful in 3m47s
A local AKILL/SQLINE/etc. pushes an ADDLINE to the ircd at once, but a ban arriving by gossip was only held for the next netburst — so a user banned on one network could keep hopping to peers until their next relink. ingest now signals BanAdded/BanLifted (all xline kinds), and gossip_ingest pushes the ADDLINE/DELLINE. Renamed AccountChange to IngestEffect to match its broader role.
This commit is contained in:
parent
886fe65e4d
commit
99df7baf10
3 changed files with 72 additions and 10 deletions
|
|
@ -461,20 +461,30 @@ impl Engine {
|
|||
// If ingesting a peer's entry removed an account a local session or channel
|
||||
// relied on (lost a conflict, or dropped elsewhere), clean up after it.
|
||||
let gone = match self.db.ingest(entry)? {
|
||||
Some(db::AccountChange::TakenOver(a)) => {
|
||||
Some(db::IngestEffect::TakenOver(a)) => {
|
||||
self.handle_account_gone(&a, "collided with another network and no longer belongs to you");
|
||||
true
|
||||
}
|
||||
Some(db::AccountChange::Dropped(a)) => {
|
||||
Some(db::IngestEffect::Dropped(a)) => {
|
||||
self.handle_account_gone(&a, "was dropped");
|
||||
true
|
||||
}
|
||||
Some(db::AccountChange::Suspended(a)) => {
|
||||
Some(db::IngestEffect::Suspended(a)) => {
|
||||
// A gossiped suspension keeps the account and its channels, but its
|
||||
// live sessions here must end (a local SUSPEND logs them out too).
|
||||
self.logout_account_sessions(&a, "was suspended");
|
||||
false
|
||||
}
|
||||
Some(db::IngestEffect::BanAdded { kind, mask, setter, duration, reason }) => {
|
||||
// Push the gossiped network ban to our ircd now, rather than only
|
||||
// holding it for the next netburst.
|
||||
self.emit_irc(NetAction::AddLine { kind, mask, setter, duration, reason });
|
||||
false
|
||||
}
|
||||
Some(db::IngestEffect::BanLifted { kind, mask }) => {
|
||||
self.emit_irc(NetAction::DelLine { kind, mask });
|
||||
false
|
||||
}
|
||||
None => false,
|
||||
};
|
||||
// handle_account_gone may have released a channel that had a bot assigned.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue