Files
lix/src/libstore
Bernardo Meurer 931930feb1 fix(libstore/lock): support users that belong to more than 10 groups
The manpage for `getgrouplist` says:

> If the number of groups of which user is a member is less than or
> equal to *ngroups, then the value *ngroups is returned.
>
> If the user is a member of more than *ngroups groups, then
> getgrouplist() returns -1.  In this case, the value returned in
> *ngroups can be used to resize the buffer passed to a further
> call getgrouplist().

In our original code, however, we allocated a list of size `10` and, if
`getgrouplist` returned `-1` threw an exception. In practice, this
caused the code to fail for any user belonging to more than 10 groups.

While unusual for single-user systems, large companies commonly have a
huge number of POSIX groups users belong to, causing this issue to crop
up and make multi-user Nix unusable in such settings.

The fix is relatively simple, when `getgrouplist` fails, it stores the
real number of GIDs in `ngroups`, so we must resize our list and retry.
Only then, if it errors once more, we can raise an exception.

This should be backported to, at least, 2.9.x.
2022-06-08 13:45:41 -04:00
..
2022-05-04 11:31:39 +02:00
2022-05-16 16:16:06 +02:00
2022-04-08 11:48:30 +02:00
2021-01-06 17:56:53 +01:00
2020-10-06 10:40:07 +02:00
2022-03-03 19:01:25 +00:00
2022-02-21 16:37:25 +01:00
2022-05-04 07:44:32 +02:00
2022-01-27 17:15:43 +01:00
2022-02-21 16:37:25 +01:00
2020-08-06 18:31:48 +00:00
2019-03-14 14:11:12 +01:00
2021-07-26 13:31:09 +02:00
2021-07-26 13:31:09 +02:00
2022-03-31 13:43:20 +02:00
2022-03-31 13:43:20 +02:00
2022-04-28 14:37:05 +02:00
2022-03-11 13:32:16 +00:00
2022-05-04 07:44:32 +02:00