diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-30 13:21:47 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-30 13:21:47 -0600 |
commit | e4b957183c4a330f020f5188f3b30b59355efb80 (patch) | |
tree | d6006fcdd00f381eefdcddac8b21235668f55d65 /ipc/winpipe/sd.go | |
parent | 950ca2ba8c026be809ced2438f89ec9146734cf7 (diff) |
winpipe: enforce ownership of client connection
Diffstat (limited to 'ipc/winpipe/sd.go')
-rw-r--r-- | ipc/winpipe/sd.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ipc/winpipe/sd.go b/ipc/winpipe/sd.go index 75686b2..4456917 100644 --- a/ipc/winpipe/sd.go +++ b/ipc/winpipe/sd.go @@ -12,9 +12,16 @@ import ( "unsafe" ) -//sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW -//sys localFree(mem uintptr) = LocalFree -//sys getSecurityDescriptorLength(sd uintptr) (len uint32) = advapi32.GetSecurityDescriptorLength +//sys convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) = advapi32.ConvertStringSecurityDescriptorToSecurityDescriptorW +//sys localFree(mem uintptr) = LocalFree +//sys getSecurityDescriptorLength(sd uintptr) (len uint32) = advapi32.GetSecurityDescriptorLength +//sys getSecurityInfo(handle syscall.Handle, objectType uint32, securityInformation uint32, owner **syscall.SID, group **syscall.SID, dacl *uintptr, sacl *uintptr, sd *uintptr) (ret error) = advapi32.GetSecurityInfo +//sys equalSid(sid1 *syscall.SID, sid2 *syscall.SID) (isEqual bool) = advapi32.EqualSid + +const ( + SE_FILE_OBJECT = 1 + OWNER_SECURITY_INFORMATION = 1 +) func SddlToSecurityDescriptor(sddl string) ([]byte, error) { var sdBuffer uintptr @@ -26,4 +33,4 @@ func SddlToSecurityDescriptor(sddl string) ([]byte, error) { sd := make([]byte, getSecurityDescriptorLength(sdBuffer)) copy(sd, (*[0xffff]byte)(unsafe.Pointer(sdBuffer))[:len(sd)]) return sd, nil -} +}
\ No newline at end of file |