warnx("%s > max uid value (%lu)", p, ULONG_MAX);
return (0);
}
- if (*ep != '\0' || ep == p) {
+ if (*ep != '\0') {
if (flags & _PWSCAN_WARN)
warnx("%s uid is incorrect", p);
return (0);
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)
warnx("%s > max gid value (%lu)", p, ULONG_MAX);
return (0);
}
- if (*ep != '\0' || ep == p) {
+ if (*ep != '\0') {
if (flags & _PWSCAN_WARN)
warnx("%s gid is incorrect", p);
return (0);