From 8376afb86b9309ee1df467ff588713ab83f66337 Mon Sep 17 00:00:00 2001 From: Maxim Konovalov Date: Fri, 11 Oct 2002 11:35:30 +0000 Subject: Do not allow empty GIDs for non-NIS entries. MFC after: 2 weeks --- libc/gen/pw_scan.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libc') 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) -- cgit v1.2.3-56-ge451