X-Git-Url: https://git.cameronkatri.com/pw-darwin.git/blobdiff_plain/274a62ea0a485df46e89a7f068f87b3b79fdee66..2dd5525fd5fa3d4c280133b37c73837bed20e5d3:/libc/gen/pw_scan.c?ds=inline diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c index 3d49aa8..9242dd0 100644 --- a/libc/gen/pw_scan.c +++ b/libc/gen/pw_scan.c @@ -10,10 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -124,6 +120,13 @@ __pw_scan(char *bp, struct passwd *pw, int flags) goto fmt; if (p[0]) pw->pw_fields |= _PWF_GID; + else { + if (pw->pw_name[0] != '+' && pw->pw_name[0] != '-') { + if (flags & _PWSCAN_WARN) + warnx("no gid for user %s", pw->pw_name); + return (0); + } + } id = strtoul(p, &ep, 10); if (errno == ERANGE) { if (flags & _PWSCAN_WARN) @@ -173,7 +176,7 @@ __pw_scan(char *bp, struct passwd *pw, int flags) goto fmt; p = pw->pw_shell; - if (root && *p) /* empty == /bin/sh */ + if (root && *p) { /* empty == /bin/sh */ for (setusershell();;) { if (!(sh = getusershell())) { if (flags & _PWSCAN_WARN) @@ -183,6 +186,8 @@ __pw_scan(char *bp, struct passwd *pw, int flags) if (!strcmp(p, sh)) break; } + endusershell(); + } if (p[0]) pw->pw_fields |= _PWF_SHELL;