diff options
author | Roy Marples <roy@marples.name> | 2007-07-02 19:57:18 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-07-02 19:57:18 +0000 |
commit | d6c72cc87c1134dbd16ebafc1f63f712a08b89e1 (patch) | |
tree | 20fcd01f180f95882970f07724eda0464f8bd96b | |
parent | 53097aedc57aafb174e32cbeb8f6527d150e2a66 (diff) |
Fix error and only let root run init commands except for status and help
-rw-r--r-- | src/librc.c | 3 | ||||
-rw-r--r-- | src/runscript.c | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/librc.c b/src/librc.c index cd085102..6392426b 100644 --- a/src/librc.c +++ b/src/librc.c @@ -224,11 +224,10 @@ bool rc_mark_service (const char *service, const rc_service_state_t state) unlink (file); i = symlink (init, file); if (i != 0) { + eerror ("symlink `%s' to `%s': %s", init, file, strerror (errno)); free (file); free (init); free (svc); - einfo ("%d %s %s", state, rc_service_state_names[state], base); - eerror ("symlink `%s' to `%s': %s", init, file, strerror (errno)); return (false); } 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 |