]> 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, 17 Mar 2021 00:11:23 +0000 (19:11 -0500)
commitcb370b19715b696cf6db4f7b357cf2e7f2e3adb7
tree400e3fab6f79a60f9a9d36198c29c8a24d18b43c
parent56dd03e0f2b17e703ba8daad8bc9ab21a761a461
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
Approved by: re (gjb)

(cherry picked from commit 55deb0a5f089c8a27cfc1666655b93881c2b47ae)
(cherry picked from commit 0c1a5eaae83267365330437adb60f44e1a622a2b)
(cherry picked from commit 872ec7e5b6f35d84745b49c02f58572632de22ed)
usr.bin/env/env.1
usr.bin/env/env.c
usr.sbin/service/service.sh