summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorMaxim Konovalov <maxim@FreeBSD.org>2002-10-11 11:35:30 +0000
committerMaxim Konovalov <maxim@FreeBSD.org>2002-10-11 11:35:30 +0000
commit8376afb86b9309ee1df467ff588713ab83f66337 (patch)
treef5f7af38f14d642cb8f4582c4447b90f0555d5d7 /libc
parent274a62ea0a485df46e89a7f068f87b3b79fdee66 (diff)
downloadpw-darwin-8376afb86b9309ee1df467ff588713ab83f66337.tar.gz
pw-darwin-8376afb86b9309ee1df467ff588713ab83f66337.tar.zst
pw-darwin-8376afb86b9309ee1df467ff588713ab83f66337.zip
Do not allow empty GIDs for non-NIS entries.
MFC after: 2 weeks
Diffstat (limited to 'libc')
-rw-r--r--libc/gen/pw_scan.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c
index 3d49aa8..e785511 100644
--- a/libc/gen/pw_scan.c
+++ b/libc/gen/pw_scan.c
@@ -124,6 +124,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)