435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
|
PSID pSid;
DWORD mask;
DWORD sidLen;
} aceEntry[3];
DWORD dw;
int isDir;
TOKEN_USER *pTokenUser = NULL;
res = -1; /* Assume failure */
attr = GetFileAttributesA(nativePath);
if (attr == 0xFFFFFFFF) {
goto done; /* Not found */
}
isDir = (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
|
>
>
>
>
|
|
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
|
PSID pSid;
DWORD mask;
DWORD sidLen;
} aceEntry[3];
DWORD dw;
int isDir;
TOKEN_USER *pTokenUser = NULL;
Tcl_DString ds;
res = -1; /* Assume failure */
Tcl_DStringInit(&ds);
Tcl_UtfToExternalDString(NULL, nativePath, -1, &ds);
attr = GetFileAttributesA(Tcl_DStringValue(&ds));
if (attr == 0xFFFFFFFF) {
goto done; /* Not found */
}
isDir = (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken)) {
|
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
|
}
/*
* Apply the new ACL. Note PROTECTED_DACL_SECURITY_INFORMATION can be used
* to remove inherited ACL (we need to overwrite the default ACL's in this case)
*/
if (SetNamedSecurityInfoA((LPSTR)nativePath, SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
NULL, NULL, newAcl, NULL) == ERROR_SUCCESS) {
res = 0;
}
done:
if (pTokenUser) {
|
|
|
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
|
}
/*
* Apply the new ACL. Note PROTECTED_DACL_SECURITY_INFORMATION can be used
* to remove inherited ACL (we need to overwrite the default ACL's in this case)
*/
if (SetNamedSecurityInfoA((LPSTR)Tcl_DStringValue(&ds), SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION | PROTECTED_DACL_SECURITY_INFORMATION,
NULL, NULL, newAcl, NULL) == ERROR_SUCCESS) {
res = 0;
}
done:
if (pTokenUser) {
|
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
|
}
if (res != 0) {
return res;
}
/* Run normal chmod command */
return chmod(nativePath, pmode);
}
/*
*---------------------------------------------------------------------------
*
* TestchmodCmd --
*
|
>
>
|
|
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
|
}
if (res != 0) {
return res;
}
/* Run normal chmod command */
res = _chmod(Tcl_DStringValue(&ds), pmode);
Tcl_DStringFree(&ds);
return res;
}
/*
*---------------------------------------------------------------------------
*
* TestchmodCmd --
*
|