Do not allow empty GIDs for non-NIS entries.

MFC after:	2 weeks
This commit is contained in:
Maxim Konovalov 2002-10-11 11:35:30 +00:00
parent 72566b4251
commit 65edeb2358

View file

@ -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)