mirror of
https://github.com/golang/go
synced 2024-11-07 00:36:15 -07:00
syscall: revert security_windows.go change of CL 201877
This CL was verified by running: go test -gcflags=all=-d=checkptr=2 internal/syscall/windows internal/syscall/windows.TestRunAtLowIntegrity uses code in question. Updates #34972 Change-Id: I434530058e2d41f132e9bf154e8c64c03894e9c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/204117 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
7a2baa9c48
commit
3b1ae308a4
@ -157,15 +157,13 @@ func LookupSID(system, account string) (sid *SID, domain string, accType uint32,
|
|||||||
// String converts sid to a string format
|
// String converts sid to a string format
|
||||||
// suitable for display, storage, or transmission.
|
// suitable for display, storage, or transmission.
|
||||||
func (sid *SID) String() (string, error) {
|
func (sid *SID) String() (string, error) {
|
||||||
// From https://docs.microsoft.com/en-us/windows/win32/secbiomet/general-constants
|
|
||||||
const SecurityMaxSidSize = 68
|
|
||||||
var s *uint16
|
var s *uint16
|
||||||
e := ConvertSidToStringSid(sid, &s)
|
e := ConvertSidToStringSid(sid, &s)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return "", e
|
return "", e
|
||||||
}
|
}
|
||||||
defer LocalFree((Handle)(unsafe.Pointer(s)))
|
defer LocalFree((Handle)(unsafe.Pointer(s)))
|
||||||
return UTF16ToString((*[SecurityMaxSidSize]uint16)(unsafe.Pointer(s))[:]), nil
|
return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Len returns the length, in bytes, of a valid security identifier sid.
|
// Len returns the length, in bytes, of a valid security identifier sid.
|
||||||
|
Loading…
Reference in New Issue
Block a user