diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-10-22 12:43:27 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-10-22 12:43:27 +0000 |
commit | 7e493b27516acecb72368fc0f0d8100356345408 (patch) | |
tree | 4e4e004943a0e72c1eb57dab4623402bd364b1a0 /usr.bin/doas/doas.c | |
parent | 91c30b956af6228115458100f4e8701f73b4c0a2 (diff) |
copying of the environment can be done later, as the user running
Diffstat (limited to 'usr.bin/doas/doas.c')
-rw-r--r-- | usr.bin/doas/doas.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c index bf12f2c2380..3e6d4bbe8b0 100644 --- a/usr.bin/doas/doas.c +++ b/usr.bin/doas/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.43 2015/10/22 04:57:20 deraadt Exp $ */ +/* $OpenBSD: doas.c,v 1.44 2015/10/22 12:43:26 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org> * @@ -417,8 +417,6 @@ main(int argc, char **argv, char **envp) if (pledge("stdio rpath getpw exec id", NULL) == -1) err(1, "pledge"); - envp = copyenv((const char **)envp, rule); - pw = getpwuid(target); if (!pw) errx(1, "no passwd entry for target"); @@ -445,6 +443,8 @@ main(int argc, char **argv, char **envp) syslog(LOG_AUTHPRIV | LOG_INFO, "%s ran command %s as %s from %s", myname, cmdline, pw->pw_name, cwd); + envp = copyenv((const char **)envp, rule); + if (rule->cmd) { if (setenv("PATH", safepath, 1) == -1) err(1, "failed to set PATH '%s'", safepath); |