FreeBSD Bugzilla – Attachment 222931 Details for
Bug 253959
service(8) env call with LDAP makes boot take many hours
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Make service(8) environment more consistent with init(8).
service.patch (text/plain), 2.39 KB, created by
Andrew "RhodiumToad" Gierth
on 2021-03-03 03:25:56 UTC
(
hide
)
Description:
Make service(8) environment more consistent with init(8).
Filename:
MIME Type:
Creator:
Andrew "RhodiumToad" Gierth
Created:
2021-03-03 03:25:56 UTC
Size:
2.39 KB
patch
obsolete
>diff --git a/usr.bin/env/env.1 b/usr.bin/env/env.1 >index 8c0527608506..9aff9508e47b 100644 >--- a/usr.bin/env/env.1 >+++ b/usr.bin/env/env.1 >@@ -31,7 +31,7 @@ > .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp > .\" $FreeBSD$ > .\" >-.Dd November 11, 2020 >+.Dd March 3, 2021 > .Dt ENV 1 > .Os > .Sh NAME >@@ -104,6 +104,11 @@ is used, then the specified user's > .Pa ~/.login_conf > is read as well. > The user may be specified by name or by uid. >+If a username of >+.Sq Li \&- >+is given, then no user lookup will be done, the login class will default to >+.Sq Li default >+if not explicitly given, and no substitutions will be done on the values. > .\" -P > .It Fl P Ar altpath > Search the set of directories as specified by >diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c >index e408577ea7a4..0aa42a4663dd 100644 >--- a/usr.bin/env/env.c >+++ b/usr.bin/env/env.c >@@ -144,16 +144,23 @@ main(int argc, char **argv) > login_class = strchr(login_name, '/'); > if (login_class) > *login_class++ = '\0'; >- pw = getpwnam(login_name); >- if (pw == NULL) { >- char *endp = NULL; >- errno = 0; >- uid = strtoul(login_name, &endp, 10); >- if (errno == 0 && *endp == '\0') >- pw = getpwuid(uid); >+ if (*login_name != '\0' && strcmp(login_name,"-") != 0) { >+ pw = getpwnam(login_name); >+ if (pw == NULL) { >+ char *endp = NULL; >+ errno = 0; >+ uid = strtoul(login_name, &endp, 10); >+ if (errno == 0 && *endp == '\0') >+ pw = getpwuid(uid); >+ } >+ if (pw == NULL) >+ errx(EXIT_FAILURE, "no such user: %s", login_name); > } >- if (pw == NULL) >- errx(EXIT_FAILURE, "no such user: %s", login_name); >+ /* >+ * Note that it is safe for pw to be null here; the libutil >+ * code handles that, bypassing substitution of $ and using >+ * the class "default" if no class name is given either. >+ */ > if (login_class != NULL) { > lc = login_getclass(login_class); > if (lc == NULL) >diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh >index 9646aae67b0c..76cce580c5b4 100755 >--- a/usr.sbin/service/service.sh >+++ b/usr.sbin/service/service.sh >@@ -171,7 +171,7 @@ cd / > for dir in /etc/rc.d $local_startup; do > if [ -x "$dir/$script" ]; then > [ -n "$VERBOSE" ] && echo "$script is located in $dir" >- exec env -i -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" >+ exec env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" > fi > done >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 253959
:
222920
| 222931