From: tedu Date: Sat, 29 Jun 2019 22:35:37 +0000 (+0000) Subject: fix some more fallout from setting path in setusercontext. restore previous behavior... X-Git-Tag: v6.6~10 X-Git-Url: https://git.armaanb.net/?p=opendoas.git;a=commitdiff_plain;h=6d8f0e61e0449a0446ef820521e94f5093b1da41 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 --- diff --git a/doas.c b/doas.c index 28954ec..7588274 100644 --- a/doas.c +++ b/doas.c @@ -500,10 +500,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); if (errno == ENOENT)