From 3151e4828a08586cdee65766c94a70488bdb0a86 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 28 Dec 2021 06:32:00 +0000 Subject: Allow normal users to run s6-l-i-hpr/s Instead of testing the euid, test writability to the shutdownd pipe. Signed-off-by: Laurent Bercot --- src/shutdown/s6-linux-init-shutdown.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/shutdown/s6-linux-init-shutdown.c') diff --git a/src/shutdown/s6-linux-init-shutdown.c b/src/shutdown/s6-linux-init-shutdown.c index 2e81c3b..011abef 100644 --- a/src/shutdown/s6-linux-init-shutdown.c +++ b/src/shutdown/s6-linux-init-shutdown.c @@ -291,10 +291,10 @@ int main (int argc, char const *const *argv) if (what == 1) what = subwhat ; else strerr_dieusage(100, USAGE) ; } - if (geteuid()) + if (!hpr_send("", 0)) { errno = EPERM ; - strerr_diefu1sys(111, "shutdown") ; + strerr_diefu1sys(111, "talk to shutdownd") ; } if (doactl) access_control() ; if (doconfirm) hpr_confirm_hostname() ; -- cgit v1.3.1