-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
os/user: make Windows user lookup treat well-known groups as valid ac…
…counts This change modifies account querying to consider both syscall.SidTypeUser and syscall.SidTypeWellKnownGroup types to be valid for user accounts. Some built-in Windows accounts such as 'NT AUTHORITY\SYSTEM' are treated by the OS as users, but are internally classified by the OS as syscall.SidTypeWellKnownGroup instead of syscall.SidTypeUser. Fixes golang#49509
- Loading branch information
Showing
2 changed files
with
25 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2022 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package user | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestLookupLocalSystem(t *testing.T) { | ||
// The string representation of the SID for `NT AUTHORITY\SYSTEM` | ||
const localSystemSID = "S-1-5-18" | ||
if _, err := LookupId(localSystemSID); err != nil { | ||
t.Fatalf("LookupId(%q): %v", localSystemSID, err) | ||
} | ||
} |