diff options
author | Gerrit Pape <pape@smarden.org> | 2003-08-08 10:17:22 +0000 |
---|---|---|
committer | Gerrit Pape <pape@smarden.org> | 2003-08-08 10:17:22 +0000 |
commit | 37f2a4fdf40b5afb24d49da4c063b2cad00ab33f (patch) | |
tree | a613137de7878dbed57c4efb0a5c8b9c614d462a /src | |
parent | 492038e0b7265e90300f4b8afe416e1a8136b59c (diff) | |
download | runit-37f2a4fdf40b5afb24d49da4c063b2cad00ab33f.tar.gz runit-37f2a4fdf40b5afb24d49da4c063b2cad00ab33f.tar.xz runit-37f2a4fdf40b5afb24d49da4c063b2cad00ab33f.zip |
0.11.0.
Diffstat (limited to 'src')
-rw-r--r-- | src/setuidgid.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/setuidgid.c b/src/setuidgid.c deleted file mode 100644 index e5a3db3..0000000 --- a/src/setuidgid.c +++ /dev/null @@ -1,33 +0,0 @@ -#include <sys/types.h> -#include <pwd.h> -#include "prot.h" -#include "strerr.h" -#include "pathexec.h" - -#define USAGE " account child" -#define FATAL "setuidgid: fatal: " - -const char *progname; - -void fatal(char *m) { strerr_die3sys(111, FATAL, m, ": "); } -void usage() { strerr_die4x(100, "usage: ", progname, USAGE, "\n"); } - -int main(int argc, const char *const *argv, const char *const *envp) { - const char *account; - struct passwd *pw; - - progname =argv[0]; - - if (! (account =*++argv)) usage(); - if (! *++argv) usage(); - - if (! (pw =getpwnam(account))) - strerr_die3x(111, FATAL, "unknown account ", account); - - if (prot_gid(pw->pw_gid) == -1) fatal("unable to setgid"); - if (prot_uid(pw->pw_uid) == -1) fatal("unable to setuid"); - - pathexec_run(*argv, argv, envp); - strerr_die4sys(111, FATAL, "unable to run ", *argv, ": "); - return(1); -} |