Describe the bug
When a group has a lot of members, sudo-rs doesn't work properly.
When sudo-rs tries to determine the gid of a named group, it calls getgrnam_r. It supplies a buffer of sysconf(_SC_GETGR_R_SIZE_MAX) or 16384 bytes. If that buffer is too small, getgrnam_r fails with ERANGE, and sudo-rs assumes the named group doesn't exist.
Expected behavior
sudo-rs should properly resolve group names for evaluating authorizations. Note that groups can have hundreds of thousands of members in large organizations.
Here's what the Linux man page for getgrnam_r states in relevant part:
The call
sysconf(_SC_GETGR_R_SIZE_MAX)
returns either -1, without changing errno, or an initial suggested size for buf. (If this size is too small, the call fails with ERANGE, in which case the caller can retry with a larger buffer.)
If getgrnam_r returns ERANGE, sudo-rs should retry with increasingly large buffer sizes.
Environment (please complete the following information):
On my system, _SC_GETGR_R_SIZE_MAX is 1024 but I have a group entry of 1182 bytes.
Describe the bug
When a group has a lot of members,
sudo-rsdoesn't work properly.When sudo-rs tries to determine the gid of a named group, it calls
getgrnam_r. It supplies a buffer ofsysconf(_SC_GETGR_R_SIZE_MAX)or 16384 bytes. If that buffer is too small,getgrnam_rfails withERANGE, and sudo-rs assumes the named group doesn't exist.Expected behavior
sudo-rsshould properly resolve group names for evaluating authorizations. Note that groups can have hundreds of thousands of members in large organizations.Here's what the Linux man page for
getgrnam_rstates in relevant part:If
getgrnam_rreturnsERANGE,sudo-rsshould retry with increasingly large buffer sizes.Environment (please complete the following information):
On my system,
_SC_GETGR_R_SIZE_MAXis 1024 but I have a group entry of 1182 bytes.