View | Details | Raw Unified | Return to bug 253959 | Differences between
and this patch

Collapse All | Expand All

(-)b/usr.bin/env/env.1 (-1 / +6 lines)
Lines 31-37 Link Here
31
.\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp
31
.\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp
32
.\" $FreeBSD$
32
.\" $FreeBSD$
33
.\"
33
.\"
34
.Dd November 11, 2020
34
.Dd March 3, 2021
35
.Dt ENV 1
35
.Dt ENV 1
36
.Os
36
.Os
37
.Sh NAME
37
.Sh NAME
Lines 104-109 is used, then the specified user's Link Here
104
.Pa ~/.login_conf
104
.Pa ~/.login_conf
105
is read as well.
105
is read as well.
106
The user may be specified by name or by uid.
106
The user may be specified by name or by uid.
107
If a username of
108
.Sq Li \&-
109
is given, then no user lookup will be done, the login class will default to
110
.Sq Li default
111
if not explicitly given, and no substitutions will be done on the values.
107
.\"	-P
112
.\"	-P
108
.It Fl P Ar altpath
113
.It Fl P Ar altpath
109
Search the set of directories as specified by
114
Search the set of directories as specified by
(-)b/usr.bin/env/env.c (-9 / +16 lines)
Lines 144-159 main(int argc, char **argv) Link Here
144
		login_class = strchr(login_name, '/');
144
		login_class = strchr(login_name, '/');
145
		if (login_class)
145
		if (login_class)
146
			*login_class++ = '\0';
146
			*login_class++ = '\0';
147
		pw = getpwnam(login_name);
147
		if (*login_name != '\0' && strcmp(login_name,"-") != 0) {
148
		if (pw == NULL) {
148
			pw = getpwnam(login_name);
149
			char *endp = NULL;
149
			if (pw == NULL) {
150
			errno = 0;
150
				char *endp = NULL;
151
			uid = strtoul(login_name, &endp, 10);
151
				errno = 0;
152
			if (errno == 0 && *endp == '\0')
152
				uid = strtoul(login_name, &endp, 10);
153
				pw = getpwuid(uid);
153
				if (errno == 0 && *endp == '\0')
154
					pw = getpwuid(uid);
155
			}
156
			if (pw == NULL)
157
				errx(EXIT_FAILURE, "no such user: %s", login_name);
154
		}
158
		}
155
		if (pw == NULL)
159
		/*
156
			errx(EXIT_FAILURE, "no such user: %s", login_name);
160
		 * Note that it is safe for pw to be null here; the libutil
161
		 * code handles that, bypassing substitution of $ and using
162
		 * the class "default" if no class name is given either.
163
		 */
157
		if (login_class != NULL) {
164
		if (login_class != NULL) {
158
			lc = login_getclass(login_class);
165
			lc = login_getclass(login_class);
159
			if (lc == NULL)
166
			if (lc == NULL)
(-)b/usr.sbin/service/service.sh (-1 / +1 lines)
Lines 171-177 cd / Link Here
171
for dir in /etc/rc.d $local_startup; do
171
for dir in /etc/rc.d $local_startup; do
172
	if [ -x "$dir/$script" ]; then
172
	if [ -x "$dir/$script" ]; then
173
		[ -n "$VERBOSE" ] && echo "$script is located in $dir"
173
		[ -n "$VERBOSE" ] && echo "$script is located in $dir"
174
		exec env -i -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@"
174
		exec env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@"
175
	fi
175
	fi
176
done
176
done
177
177

Return to bug 253959