]> Cypherpunks repositories - gostls13.git/commit
os/user: fix darwin GetGroupIds for n > 256
authorKevin Burke <kev@inburke.com>
Mon, 31 Jul 2017 04:14:10 +0000 (21:14 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 22 Nov 2017 17:14:47 +0000 (17:14 +0000)
commitf100e0c228df5df22fc3b85152a10059fa9874a6
treebe20320b01974ab6f15553879d2eaeb64802a606
parent64b68bedc52d0b6eb7f464793c2be38382fadb6b
os/user: fix darwin GetGroupIds for n > 256

If a Mac user has more than 256 groups, getGroupList returns -1 but
does not correctly set n. We need to retry the syscall with an
ever-increasing group size until we get all of the user's groups.

The easiest way to test this change is to set n to a value lower than
the current user's number of groups, test on a Mac and observe
a failure, then apply the patch and test that it passes.

Fixes #21067.

Change-Id: I0f5c4eac1c465226a460bc0803eff791dcfd4200
Reviewed-on: https://go-review.googlesource.com/51892
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/os/user/getgrouplist_darwin.go
src/os/user/getgrouplist_unix.go
src/os/user/listgroups_unix.go