mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 09:57:41 +00:00
Solaris maps negative gids to GID_NOBODY.
This commit is contained in:
parent
50bdd5f131
commit
c5971524f1
@ -153,9 +153,18 @@ str2grp(const char *instr, int inlen, void *ent, char *buf, int buflen)
|
|||||||
gid = strtoul(cp, &ep, 10);
|
gid = strtoul(cp, &ep, 10);
|
||||||
if (*cp == '\0' || *ep != '\0')
|
if (*cp == '\0' || *ep != '\0')
|
||||||
return yp ? NSS_STR_PARSE_SUCCESS : NSS_STR_PARSE_PARSE;
|
return yp ? NSS_STR_PARSE_SUCCESS : NSS_STR_PARSE_PARSE;
|
||||||
if (gid > GID_MAX || (gid == ULONG_MAX && errno == ERANGE))
|
#ifdef GID_NOBODY
|
||||||
|
if (*cp == '-' && gid != 0) {
|
||||||
|
/* Negative gids get mapped to nobody on Solaris. */
|
||||||
|
grp->gr_gid = GID_NOBODY;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
if ((errno == ERANGE && gid == ULONG_MAX) ||
|
||||||
|
gid > GID_MAX || gid != (gid_t)gid) {
|
||||||
return NSS_STR_PARSE_ERANGE;
|
return NSS_STR_PARSE_ERANGE;
|
||||||
grp->gr_gid = (gid_t)gid;
|
} else {
|
||||||
|
grp->gr_gid = (gid_t)gid;
|
||||||
|
}
|
||||||
|
|
||||||
/* Store group members, taking care to use proper alignment. */
|
/* Store group members, taking care to use proper alignment. */
|
||||||
grp->gr_mem = NULL;
|
grp->gr_mem = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user