]> Cypherpunks repositories - gostls13.git/commit
os/user: fix Current().GroupIds() for AD joined users on Windows
authorqmuntal <quimmuntal@gmail.com>
Fri, 6 Sep 2024 13:51:44 +0000 (15:51 +0200)
committerQuim Muntal <quimmuntal@gmail.com>
Mon, 16 Sep 2024 20:48:56 +0000 (20:48 +0000)
commitae8708f7441b24dac126122c5365327d29fa0012
tree914a96a5165d91af91354dada7363a40900c944f
parent2927aa10ab1a184f02f7b7eb3c4a490906238e7a
os/user: fix Current().GroupIds() for AD joined users on Windows

This CL special-case User.GroupIds to get the group IDs from the user's
token when the user is the current user.

This approach is more efficient than calling NetUserGetLocalGroups.
It is also more reliable for users joined to an Active Directory domain,
where NetUserGetLocalGroups is likely to fail.

Updates #26041.
Fixes #62712.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: If7c30287192872077b98a514bd6346dbd1a64fb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/611116
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/syscall/windows/security_windows.go
src/os/user/lookup_windows.go