Tcl Source Code

Check-in [a4746b4c9f]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-7a9dc52b29
Files: files | file ages | folders
SHA3-256: a4746b4c9f544c34bfa11296194796495ddd1524461778083f390d467fa9973e
User & Date: sebres 2018-11-21 10:00:54
Context
2018-11-22
12:45
prepare merge: TclJoinPath is in internal API (MODULE_SCOPE) since 8.6 and static (used locally in t... Closed-Leaf check-in: fba9c8383c user: sebres tags: bug-7a9dc52b29
2018-11-21
10:00
win: repair test command "testchmod": correct load module (ADVAPI32 for x86/x64) and fix readonly ma... check-in: a4746b4c9f user: sebres tags: bug-7a9dc52b29
2018-11-20
20:56
win: fixed pwd-related test-cases in winPipe.test: several test-cases expect current directory equal... check-in: 8125c3109a user: sebres tags: bug-7a9dc52b29
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to win/tclWinTest.c.

   416    416       typedef BOOL (WINAPI *lookupAccountNameADef)(LPCSTR, LPCSTR, PSID,
   417    417   	    PDWORD, LPSTR, LPDWORD, PSID_NAME_USE);
   418    418       typedef BOOL (WINAPI *getFileSecurityADef)(LPCSTR, SECURITY_INFORMATION,
   419    419   	    PSECURITY_DESCRIPTOR, DWORD, LPDWORD);
   420    420   
   421    421       static const SECURITY_INFORMATION infoBits = OWNER_SECURITY_INFORMATION
   422    422   	    | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION;
          423  +    /* don't deny DELETE mask (reset writable only, allow test-cases cleanup) */
   423    424       static const DWORD readOnlyMask = FILE_DELETE_CHILD | FILE_ADD_FILE
   424    425   	    | FILE_ADD_SUBDIRECTORY | FILE_WRITE_EA | FILE_APPEND_DATA
   425         -	    | FILE_WRITE_DATA | DELETE;
          426  +	    | FILE_WRITE_DATA
          427  +	    /* | DELETE */;
   426    428   
   427    429       /*
   428    430        * References to security functions (only available on NT and later).
   429    431        */
   430    432   
   431    433       static getSidLengthRequiredDef getSidLengthRequiredProc;
   432    434       static initializeSidDef initializeSidProc;
................................................................................
   462    464        * One time initialization, dynamically load Windows NT features
   463    465        */
   464    466   
   465    467       if (!initialized) {
   466    468   	TCL_DECLARE_MUTEX(initializeMutex)
   467    469   	Tcl_MutexLock(&initializeMutex);
   468    470   	if (!initialized) {
   469         -	    HMODULE handle = GetModuleHandle(TEXT("ADVAPI"));
          471  +	    HMODULE handle = GetModuleHandle(TEXT("ADVAPI32"));
          472  +	    if (handle == NULL) {
          473  +	    	handle = GetModuleHandle(TEXT("ADVAPI"));
          474  +	    }
   470    475   
   471    476   	    if (handle != NULL) {
   472    477   		setNamedSecurityInfoProc = (setNamedSecurityInfoADef)
   473    478   			GetProcAddress(handle, "SetNamedSecurityInfoA");
   474    479   		getFileSecurityProc = (getFileSecurityADef)
   475    480   			GetProcAddress(handle, "GetFileSecurityA");
   476    481   		getAceProc = (getAceDef)
................................................................................
   657    662   	if (!addAceProc(newAcl, ACL_REVISION, MAXDWORD, (PACL *)pACE2,
   658    663   		((PACE_HEADER) pACE2)->AceSize)) {
   659    664   	    goto done;
   660    665   	}
   661    666       }
   662    667   
   663    668       /*
   664         -     * Apply the new ACL.
          669  +     * Apply the new ACL. Note PROTECTED_DACL_SECURITY_INFORMATION can be used
          670  +     * to remove inherited ACL (we need to overwrite the default ACL's in this case)
   665    671        */
   666    672   
   667    673       if (set_readOnly == acl_readOnly_found || setNamedSecurityInfoProc(
   668         -	    (LPSTR) nativePath, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
          674  +	    (LPSTR) nativePath, SE_FILE_OBJECT, 
          675  +	    DACL_SECURITY_INFORMATION /*| PROTECTED_DACL_SECURITY_INFORMATION*/,
   669    676   	    NULL, NULL, newAcl, NULL) == ERROR_SUCCESS) {
   670    677   	res = 0;
   671    678       }
   672    679   
   673    680     done:
   674    681       if (secDesc) {
   675    682   	ckfree((char *) secDesc);