Log store write failures at the source; share the oper guard

The store's map_err(|_| Internal) discarded the real IO error, so a
disk-full or permissions failure was invisible; log it once in the log
append path where it happens. Add echo_api::require_oper (parameterised
by the required privilege) and route the three copied per-service guards
through it, keeping each service's own wording and policy.
This commit is contained in:
Jean Chevronnet 2026-07-14 23:19:00 +00:00
parent 081d90ad68
commit d9c0878b00
No known key found for this signature in database
5 changed files with 23 additions and 16 deletions

View file

@ -87,11 +87,7 @@ impl Service for HelpServ {
// Working the help queue is operator-only.
fn require_oper(me: &str, from: &Sender, ctx: &mut ServiceCtx) -> bool {
if from.privs.any() {
return true;
}
ctx.notice(me, from.uid, "Access denied — working the help queue is for services operators.");
false
echo_api::require_oper(me, from, ctx, None, "working the help queue")
}
// Claim ticket `id` for the calling operator (shared by TAKE and NEXT).

View file

@ -103,11 +103,7 @@ impl Service for HostServ {
// Operator gate for vhost administration.
fn require_oper(me: &str, from: &Sender, ctx: &mut ServiceCtx) -> bool {
if from.privs.has(Priv::Admin) {
return true;
}
ctx.notice(me, from.uid, "Access denied — assigning vhosts is for services operators.");
false
echo_api::require_oper(me, from, ctx, Some(Priv::Admin), "assigning vhosts")
}
// Canonicalise a vhost the way the ircd will actually display it: the host part

View file

@ -66,9 +66,5 @@ impl Service for ReportServ {
// Reviewing the queue is for operators only.
fn require_oper(me: &str, from: &Sender, ctx: &mut ServiceCtx) -> bool {
if from.privs.any() {
return true;
}
ctx.notice(me, from.uid, "Access denied — reviewing reports is for services operators.");
false
echo_api::require_oper(me, from, ctx, None, "reviewing reports")
}