Add sbin and /usr/local directories to _PATH_DEFPATH.
Set _PATH_DEFPATH to /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin. This is the path in the default class in the default /etc/login.conf, excluding ~/bin which would not be expanded properly in a string constant. For normal logins, _PATH_DEFPATH is overridden by /etc/login.conf, ~/.login_conf or shell startup files. _PATH_DEFPATH is still used as a default by execlp(), execvp(), posix_spawnp() and sh if PATH is not set, and by cron. Especially the latter is a common trap (most recently in PR 204813). PR: 204813 Reviewed by: secteam (delphij), alfred
This commit is contained in:
parent
16ef2e1a9b
commit
43d53dba8f
@ -36,7 +36,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/* Default search path. */
|
||||
#define _PATH_DEFPATH "/usr/bin:/bin"
|
||||
#define _PATH_DEFPATH "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
|
||||
/* All standard utilities path. */
|
||||
#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
/* Locate system binaries. */
|
||||
@ -108,7 +108,7 @@ __END_DECLS
|
||||
|
||||
#ifdef RESCUE
|
||||
#undef _PATH_DEFPATH
|
||||
#define _PATH_DEFPATH "/rescue:/usr/bin:/bin"
|
||||
#define _PATH_DEFPATH "/rescue:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
|
||||
#undef _PATH_STDPATH
|
||||
#define _PATH_STDPATH "/rescue:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
#undef _PATH_SYSPATH
|
||||
|
@ -28,7 +28,7 @@
|
||||
.\" @(#)exec.3 8.3 (Berkeley) 1/24/94
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd December 12, 2015
|
||||
.Dd January 5, 2016
|
||||
.Dt EXEC 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -161,7 +161,7 @@ the default path is set according to the
|
||||
definition in
|
||||
.In paths.h ,
|
||||
which is set to
|
||||
.Dq Ev /usr/bin:/bin .
|
||||
.Dq Ev /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin .
|
||||
For
|
||||
.Fn execvP ,
|
||||
the search path is specified as an argument to the function.
|
||||
|
@ -34,7 +34,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd June 17, 2011
|
||||
.Dd January 5, 2016
|
||||
.Dt POSIX_SPAWN 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -126,7 +126,7 @@ the default path is set according to the
|
||||
definition in
|
||||
.In paths.h ,
|
||||
which is set to
|
||||
.Dq Ev /usr/bin:/bin .
|
||||
.Dq Ev /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin .
|
||||
.Pp
|
||||
If
|
||||
.Fa file_actions
|
||||
|
@ -17,7 +17,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd April 28, 2012
|
||||
.Dd January 5, 2016
|
||||
.Dt CRONTAB 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -74,7 +74,7 @@ is set to
|
||||
.Pa /bin/sh ,
|
||||
.Ev PATH
|
||||
is set to
|
||||
.Pa /usr/bin:/bin ,
|
||||
.Pa /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin ,
|
||||
and
|
||||
.Ev LOGNAME
|
||||
and
|
||||
|
Loading…
Reference in New Issue
Block a user