pkg/system: deprecate SetNamedSecurityInfo, GetSecurityDescriptorDacl
| ... | ... |
@@ -67,21 +67,17 @@ func fixPermissionsWindows(source, destination, SID string) error {
|
| 67 | 67 |
sddlString := system.SddlAdministratorsLocalSystem |
| 68 | 68 |
sddlString += "(A;OICI;GRGWGXRCWDSD;;;" + SID + ")" |
| 69 | 69 |
|
| 70 |
- securityDescriptor, err := winio.SddlToSecurityDescriptor(sddlString) |
|
| 70 |
+ securityDescriptor, err := windows.SecurityDescriptorFromString(sddlString) |
|
| 71 | 71 |
if err != nil {
|
| 72 | 72 |
return err |
| 73 | 73 |
} |
| 74 | 74 |
|
| 75 |
- var daclPresent uint32 |
|
| 76 |
- var daclDefaulted uint32 |
|
| 77 |
- var dacl *byte |
|
| 78 |
- |
|
| 79 |
- err = system.GetSecurityDescriptorDacl(&securityDescriptor[0], &daclPresent, &dacl, &daclDefaulted) |
|
| 75 |
+ dacl, _, err := securityDescriptor.DACL() |
|
| 80 | 76 |
if err != nil {
|
| 81 | 77 |
return err |
| 82 | 78 |
} |
| 83 | 79 |
|
| 84 |
- return system.SetNamedSecurityInfo(windows.StringToUTF16Ptr(destination), windows.SE_FILE_OBJECT, windows.OWNER_SECURITY_INFORMATION|windows.DACL_SECURITY_INFORMATION, sid, nil, dacl, nil) |
|
| 80 |
+ return windows.SetNamedSecurityInfo(destination, windows.SE_FILE_OBJECT, windows.OWNER_SECURITY_INFORMATION|windows.DACL_SECURITY_INFORMATION, sid, nil, dacl, nil) |
|
| 85 | 81 |
} |
| 86 | 82 |
|
| 87 | 83 |
func validateCopySourcePath(imageSource *imageMount, origPath, platform string) error {
|
| ... | ... |
@@ -113,6 +113,7 @@ func HasWin32KSupport() bool {
|
| 113 | 113 |
return ntuserApiset.Load() == nil |
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 |
+// Deprecated: use golang.org/x/sys/windows.SetNamedSecurityInfo() |
|
| 116 | 117 |
func SetNamedSecurityInfo(objectName *uint16, objectType uint32, securityInformation uint32, sidOwner *windows.SID, sidGroup *windows.SID, dacl *byte, sacl *byte) (result error) {
|
| 117 | 118 |
r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfo.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(sidOwner)), uintptr(unsafe.Pointer(sidGroup)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) |
| 118 | 119 |
if r0 != 0 {
|
| ... | ... |
@@ -121,6 +122,7 @@ func SetNamedSecurityInfo(objectName *uint16, objectType uint32, securityInforma |
| 121 | 121 |
return |
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 |
+// Deprecated: uses golang.org/x/sys/windows.SecurityDescriptorFromString() and golang.org/x/sys/windows.SECURITY_DESCRIPTOR.DACL() |
|
| 124 | 125 |
func GetSecurityDescriptorDacl(securityDescriptor *byte, daclPresent *uint32, dacl **byte, daclDefaulted *uint32) (result error) {
|
| 125 | 126 |
r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(securityDescriptor)), uintptr(unsafe.Pointer(daclPresent)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclDefaulted)), 0, 0) |
| 126 | 127 |
if r1 == 0 {
|