File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 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 {
55875587 PACL acl ;
55885588 SECURITY_DESCRIPTOR sd ;
55895589 EXPLICIT_ACCESS_W ea [4 ];
5590+ char sid [64 ];
55905591};
55915592
55925593static int
@@ -5616,13 +5617,25 @@ initializeMkdir700SecurityAttributes(
56165617 return GetLastError ();
56175618 }
56185619
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+
56195626 data -> securityAttributes .nLength = sizeof (SECURITY_ATTRIBUTES );
56205627 data -> ea [0 ].grfAccessPermissions = GENERIC_ALL ;
56215628 data -> ea [0 ].grfAccessMode = SET_ACCESS ;
56225629 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+ }
56265639
56275640 data -> ea [1 ].grfAccessPermissions = GENERIC_ALL ;
56285641 data -> ea [1 ].grfAccessMode = SET_ACCESS ;
You can’t perform that action at this time.
0 commit comments