From d6c72cc87c1134dbd16ebafc1f63f712a08b89e1 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 2 Jul 2007 19:57:18 +0000 Subject: Fix error and only let root run init commands except for status and help --- src/runscript.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/runscript.c') diff --git a/src/runscript.c b/src/runscript.c index 18ee1ddd..18515372 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -1140,6 +1140,13 @@ int main (int argc, char **argv) if (sighup) exit (EXIT_FAILURE); + if (strcmp (optarg, "status") != 0 && + strcmp (optarg, "help") != 0) { + /* Only root should be able to run us */ + if (geteuid () != 0) + eerrorx ("%s: root access required", applet); + } + /* Export the command we're running. This is important as we stamp on the restart function now but some start/stop routines still need to behave differently if -- cgit v1.2.3