opendoas

my fork of doas with custom prompt
git clone git://git.kocotian.pl/opendoas.git
Log | Files | Refs | README | LICENSE

commit d5acd52e2a15c36a8e06f9103d35622933aa422d
parent 01ac84109c99e94bf61c0a4039c76b8af289c499
Author: Duncan Overbruck <mail@duncano.de>
Date:   Thu, 28 Jan 2021 17:58:34 +0100

correctly reset path for rules without specific command

This is a fixup for commit 01c658f8c45cb92a343be5f32aa6da70b2032168
where the behaviour was changed to not inherit the PATH variable
by default.

Diffstat:
Mdoas.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/doas.c b/doas.c @@ -386,6 +386,7 @@ main(int argc, char **argv) #ifdef HAVE_LOGIN_CAP_H if (setusercontext(NULL, targpw, target, LOGIN_SETGROUP | + LOGIN_SETPATH | LOGIN_SETPRIORITY | LOGIN_SETRESOURCES | LOGIN_SETUMASK | LOGIN_SETUSER) != 0) errx(1, "failed to set user context for target"); @@ -396,6 +397,8 @@ main(int argc, char **argv) err(1, "initgroups"); if (setresuid(target, target, target) != 0) err(1, "setresuid"); + if (setenv("PATH", safepath, 1) == -1) + err(1, "failed to set PATH '%s'", safepath); #endif if (getcwd(cwdpath, sizeof(cwdpath)) == NULL)