summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-11-21 10:00:54 (GMT)
committersebres <sebres@users.sourceforge.net>2018-11-21 10:00:54 (GMT)
commite02fb5a67bc4951e4e36007d4ddaaad531846b2b (patch)
tree610ce88e2367dfebf8a069858bcf2644e1569a1b
parent8c233c93c1ce27186c71a73472267447eab13f1b (diff)
downloadtcl-e02fb5a67bc4951e4e36007d4ddaaad531846b2b.zip
tcl-e02fb5a67bc4951e4e36007d4ddaaad531846b2b.tar.gz
tcl-e02fb5a67bc4951e4e36007d4ddaaad531846b2b.tar.bz2
win: repair test command "testchmod": correct load module (ADVAPI32 for x86/x64) and fix readonly mask (don't deny DELETE mask, test cleanup should be able to delete entry)
-rw-r--r--win/tclWinTest.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index 73f4e45..7f49b63 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -420,9 +420,11 @@ TestplatformChmod(
static const SECURITY_INFORMATION infoBits = OWNER_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
+ /* don't deny DELETE mask (reset writable only, allow test-cases cleanup) */
static const DWORD readOnlyMask = FILE_DELETE_CHILD | FILE_ADD_FILE
| FILE_ADD_SUBDIRECTORY | FILE_WRITE_EA | FILE_APPEND_DATA
- | FILE_WRITE_DATA | DELETE;
+ | FILE_WRITE_DATA
+ /* | DELETE */;
/*
* References to security functions (only available on NT and later).
@@ -466,7 +468,10 @@ TestplatformChmod(
TCL_DECLARE_MUTEX(initializeMutex)
Tcl_MutexLock(&initializeMutex);
if (!initialized) {
- HMODULE handle = GetModuleHandle(TEXT("ADVAPI"));
+ HMODULE handle = GetModuleHandle(TEXT("ADVAPI32"));
+ if (handle == NULL) {
+ handle = GetModuleHandle(TEXT("ADVAPI"));
+ }
if (handle != NULL) {
setNamedSecurityInfoProc = (setNamedSecurityInfoADef)
@@ -661,11 +666,13 @@ TestplatformChmod(
}
/*
- * Apply the new ACL.
+ * 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 (set_readOnly == acl_readOnly_found || setNamedSecurityInfoProc(
- (LPSTR) nativePath, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
+ (LPSTR) nativePath, SE_FILE_OBJECT,
+ DACL_SECURITY_INFORMATION /*| PROTECTED_DACL_SECURITY_INFORMATION*/,
NULL, NULL, newAcl, NULL) == ERROR_SUCCESS) {
res = 0;
}