diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/staprun/ChangeLog | 5 | ||||
-rw-r--r-- | runtime/staprun/staprun.c | 20 |
2 files changed, 16 insertions, 9 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog index 4e23c424..2a9029d0 100644 --- a/runtime/staprun/ChangeLog +++ b/runtime/staprun/ChangeLog @@ -1,3 +1,8 @@ +2007-10-11 Frank Ch. Eigler <fche@elastic.org> + + * staprun.c (main): Move checks for init_cap and getuid + from just before command line argument parsing to just after. + 2007-10-09 Martin Hunt <hunt@redhat.com> * common.c (set_clexec): New. diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index 67b01abb..44ac0313 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -211,15 +211,8 @@ int main(int argc, char **argv) exit(1); } - if (geteuid() != 0) { - err("ERROR: The effective user ID of staprun must be set to the root user.\n" - " Check permissions on staprun and ensure it is a setuid root program.\n"); - exit(1); - } - - if (!init_cap()) - exit(1); - + /* NB: Don't do the geteuid()!=0 check here, since we want to + test command-line error-handling while running non-root. */ /* Get rid of a few standard environment variables (which */ /* might cause us to do unintended things). */ rc = unsetenv("IFS") || unsetenv("CDPATH") || unsetenv("ENV") @@ -258,6 +251,15 @@ int main(int argc, char **argv) usage(argv[0]); } + if (geteuid() != 0) { + err("ERROR: The effective user ID of staprun must be set to the root user.\n" + " Check permissions on staprun and ensure it is a setuid root program.\n"); + exit(1); + } + + if (!init_cap()) + exit(1); + if (check_permissions() != 1) usage(argv[0]); |