]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
service(8): use an environment more consistent with init(8)
authorAndrew Gierth <andrew@tao146.riddles.org.uk>
Wed, 3 Mar 2021 18:25:11 +0000 (12:25 -0600)
committerKyle Evans <kevans@FreeBSD.org>
Wed, 3 Mar 2021 18:25:11 +0000 (12:25 -0600)
commit55deb0a5f089c8a27cfc1666655b93881c2b47ae
tree3ce0258b3e2f6040d47a4935133e7e43a7819796
parentaff9b9ee894e3e6b6d8c7e4182d6b973804df853
service(8): use an environment more consistent with init(8)

init(8) sets the "daemon" login class without specifying a pw
entry (so no substitutions are done on the variables). service(8)'s
use of env -L had the effect of specifying root's pw entry, with two
effects: getpwnam and getpwuid are being called, which may not be
entirely safe depending on what nsswitch is up to and what stage of
boot we are at, and substitutions would have been done.

Fix by teaching env(8) to allow -L -/classname to set the class
environment with no pw entry at all specified, and use it in
service(8).

PR: 253959
usr.bin/env/env.1
usr.bin/env/env.c
usr.sbin/service/service.sh