summaryrefslogtreecommitdiff
path: root/usr.bin/doas
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2019-06-29 22:35:38 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2019-06-29 22:35:38 +0000
commit91e3ddbb281f9879c242f8f5f87baedabb33b77f (patch)
treeff50e223de27f37b2b226a1a17efec5e76297de7 /usr.bin/doas
parentdec59e66613f83c1470e4e2466a4273889116394 (diff)
fix some more fallout from setting path in setusercontext. restore
previous behavior of using user PATH if no cmd restriction in the rule. run into by espie
Diffstat (limited to 'usr.bin/doas')
-rw-r--r--usr.bin/doas/doas.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/doas/doas.c b/usr.bin/doas/doas.c
index ec21a61ffb4..c52d09cbcda 100644
--- a/usr.bin/doas/doas.c
+++ b/usr.bin/doas/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.78 2019/06/17 19:51:23 tedu Exp $ */
+/* $OpenBSD: doas.c,v 1.79 2019/06/29 22:35:37 tedu Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -448,10 +448,13 @@ main(int argc, char **argv)
envp = prepenv(rule, mypw, targpw);
+ /* setusercontext set path for the next process, so reset it for us */
if (rule->cmd) {
- /* do this again after setusercontext reset it */
if (setenv("PATH", safepath, 1) == -1)
err(1, "failed to set PATH '%s'", safepath);
+ } else {
+ if (setenv("PATH", formerpath, 1) == -1)
+ err(1, "failed to set PATH '%s'", formerpath);
}
execvpe(cmd, argv, envp);
fail: