File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -5587,6 +5587,7 @@ struct _Py_SECURITY_ATTRIBUTE_DATA {
5587
5587
PACL acl ;
5588
5588
SECURITY_DESCRIPTOR sd ;
5589
5589
EXPLICIT_ACCESS_W ea [4 ];
5590
+ char sid [64 ];
5590
5591
};
5591
5592
5592
5593
static int
@@ -5616,13 +5617,25 @@ initializeMkdir700SecurityAttributes(
5616
5617
return GetLastError ();
5617
5618
}
5618
5619
5620
+ int use_alias = 0 ;
5621
+ DWORD cbSid = sizeof (data -> sid );
5622
+ if (!CreateWellKnownSid (WinCreatorOwnerRightsSid , NULL , (PSID )data -> sid , & cbSid )) {
5623
+ use_alias = 1 ;
5624
+ }
5625
+
5619
5626
data -> securityAttributes .nLength = sizeof (SECURITY_ATTRIBUTES );
5620
5627
data -> ea [0 ].grfAccessPermissions = GENERIC_ALL ;
5621
5628
data -> ea [0 ].grfAccessMode = SET_ACCESS ;
5622
5629
data -> ea [0 ].grfInheritance = SUB_CONTAINERS_AND_OBJECTS_INHERIT ;
5623
- data -> ea [0 ].Trustee .TrusteeForm = TRUSTEE_IS_NAME ;
5624
- data -> ea [0 ].Trustee .TrusteeType = TRUSTEE_IS_ALIAS ;
5625
- data -> ea [0 ].Trustee .ptstrName = L"CURRENT_USER" ;
5630
+ if (use_alias ) {
5631
+ data -> ea [0 ].Trustee .TrusteeForm = TRUSTEE_IS_NAME ;
5632
+ data -> ea [0 ].Trustee .TrusteeType = TRUSTEE_IS_ALIAS ;
5633
+ data -> ea [0 ].Trustee .ptstrName = L"CURRENT_USER" ;
5634
+ } else {
5635
+ data -> ea [0 ].Trustee .TrusteeForm = TRUSTEE_IS_SID ;
5636
+ data -> ea [0 ].Trustee .TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP ;
5637
+ data -> ea [0 ].Trustee .ptstrName = (LPWCH )(SID * )data -> sid ;
5638
+ }
5626
5639
5627
5640
data -> ea [1 ].grfAccessPermissions = GENERIC_ALL ;
5628
5641
data -> ea [1 ].grfAccessMode = SET_ACCESS ;
You can’t perform that action at this time.
0 commit comments