customtitle: verify a KDF /TITLE password off the core thread (Event::TitleAuth) — /TITLE spam can't freeze the server

This commit is contained in:
Jean Chevronnet 2026-08-12 13:07:28 +00:00
parent 7cb58586b4
commit 2b3495be65
2 changed files with 78 additions and 32 deletions

View file

@ -66,6 +66,13 @@ pub enum Event {
algo: String,
hash: Option<String>,
},
/// A background `/TITLE` password verify finished (see `crate::modules::customtitle`).
TitleAuth {
uid: Uid,
ok: bool,
title: String,
vhost: String,
},
/// A module's async HTTP request finished. `tag` is `"<module>:<detail>"`
/// so the core can route the reply back to the module that issued it (e.g.
/// account registration, captcha verification). `status` is 0 on transport
@ -241,6 +248,18 @@ impl Ircd {
};
self.server.send(uid, line);
}
Event::TitleAuth {
uid,
ok,
title,
vhost,
} => {
if ok {
crate::modules::customtitle::grant(&mut self.server, uid, &title, &vhost);
} else {
crate::modules::customtitle::deny(&self.server, uid);
}
}
Event::HttpResult {
uid,
tag,