Tcl Source Code

Hex Artifact Content
Login

Artifact d7fb5977c602741ea01c8e6095916f143c0f3420:

Attachment "generic-testTcl.c.diff-u" to ticket [1344540fff] added by jfg118 2006-03-14 06:57:39.
0000: 2d 2d 2d 20 2e 2e 2f 2e 2e 2f 74 63 6c 38 2e 34  --- ../../tcl8.4
0010: 2e 31 32 2d 73 72 63 2f 74 63 6c 38 2e 34 2e 31  .12-src/tcl8.4.1
0020: 32 2f 67 65 6e 65 72 69 63 2f 74 63 6c 54 65 73  2/generic/tclTes
0030: 74 2e 63 09 32 30 30 35 2d 31 30 2d 32 33 20 31  t.c.2005-10-23 1
0040: 36 3a 30 31 3a 33 30 2e 30 30 30 30 30 30 30 30  6:01:30.00000000
0050: 30 20 2d 30 37 30 30 0a 2b 2b 2b 20 67 65 6e 65  0 -0700.+++ gene
0060: 72 69 63 2f 74 63 6c 54 65 73 74 2e 63 09 32 30  ric/tclTest.c.20
0070: 30 36 2d 30 33 2d 31 33 20 30 39 3a 34 35 3a 33  06-03-13 09:45:3
0080: 39 2e 34 38 31 32 32 34 30 30 30 20 2d 30 38 30  9.481224000 -080
0090: 30 0a 40 40 20 2d 34 30 31 38 2c 36 20 2b 34 30  0.@@ -4018,6 +40
00a0: 31 38 2c 32 35 35 20 40 40 0a 20 20 2a 2d 2d 2d  18,255 @@.  *---
00b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
00f0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 2f 0a 20 20  --------.  */.  
0100: 0a 2b 23 69 66 64 65 66 20 5f 5f 57 49 4e 33 32  .+#ifdef __WIN32
0110: 5f 5f 0a 2b 23 69 6e 63 6c 75 64 65 20 3c 61 63  __.+#include <ac
0120: 6c 61 70 69 2e 68 3e 0a 2b 23 65 6e 64 69 66 0a  lapi.h>.+#endif.
0130: 2b 0a 2b 73 74 61 74 69 63 20 69 6e 74 20 54 65  +.+static int Te
0140: 73 74 70 6c 61 66 74 6f 72 6d 5f 63 68 6d 6f 64  stplaftorm_chmod
0150: 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 6e 61 74  (const char *nat
0160: 69 76 65 50 61 74 68 2c 20 69 6e 74 20 70 6d 6f  ivePath, int pmo
0170: 64 65 29 0a 2b 7b 0a 2b 23 69 66 64 65 66 20 5f  de).+{.+#ifdef _
0180: 5f 57 49 4e 33 32 5f 5f 0a 2b 20 20 20 20 73 74  _WIN32__.+    st
0190: 61 74 69 63 20 63 6f 6e 73 74 20 63 68 61 72 20  atic const char 
01a0: 65 76 65 72 79 6f 6e 65 42 75 66 5b 5d 20 3d 20  everyoneBuf[] = 
01b0: 22 45 56 45 52 59 4f 4e 45 22 3b 0a 2b 20 20 20  "EVERYONE";.+   
01c0: 20 73 74 61 74 69 63 20 63 6f 6e 73 74 20 53 45   static const SE
01d0: 43 55 52 49 54 59 5f 49 4e 46 4f 52 4d 41 54 49  CURITY_INFORMATI
01e0: 4f 4e 20 69 6e 66 6f 42 69 74 73 20 3d 20 4f 57  ON infoBits = OW
01f0: 4e 45 52 5f 53 45 43 55 52 49 54 59 5f 49 4e 46  NER_SECURITY_INF
0200: 4f 52 4d 41 54 49 4f 4e 20 0a 2b 20 20 20 20 20  ORMATION .+     
0210: 20 7c 20 47 52 4f 55 50 5f 53 45 43 55 52 49 54   | GROUP_SECURIT
0220: 59 5f 49 4e 46 4f 52 4d 41 54 49 4f 4e 20 7c 20  Y_INFORMATION | 
0230: 44 41 43 4c 5f 53 45 43 55 52 49 54 59 5f 49 4e  DACL_SECURITY_IN
0240: 46 4f 52 4d 41 54 49 4f 4e 3b 0a 2b 20 20 20 20  FORMATION;.+    
0250: 73 74 61 74 69 63 20 63 6f 6e 73 74 20 44 57 4f  static const DWO
0260: 52 44 20 72 65 61 64 4f 6e 6c 79 4d 61 73 6b 20  RD readOnlyMask 
0270: 3d 20 46 49 4c 45 5f 44 45 4c 45 54 45 5f 43 48  = FILE_DELETE_CH
0280: 49 4c 44 20 7c 20 46 49 4c 45 5f 41 44 44 5f 46  ILD | FILE_ADD_F
0290: 49 4c 45 20 0a 2b 20 20 20 20 20 20 7c 20 46 49  ILE .+      | FI
02a0: 4c 45 5f 41 44 44 5f 53 55 42 44 49 52 45 43 54  LE_ADD_SUBDIRECT
02b0: 4f 52 59 20 7c 20 46 49 4c 45 5f 57 52 49 54 45  ORY | FILE_WRITE
02c0: 5f 45 41 20 7c 20 20 46 49 4c 45 5f 41 50 50 45  _EA |  FILE_APPE
02d0: 4e 44 5f 44 41 54 41 20 0a 2b 20 20 20 20 20 20  ND_DATA .+      
02e0: 7c 20 46 49 4c 45 5f 57 52 49 54 45 5f 44 41 54  | FILE_WRITE_DAT
02f0: 41 20 7c 20 44 45 4c 45 54 45 3b 0a 2b 0a 2b 20  A | DELETE;.+.+ 
0300: 20 20 20 42 59 54 45 20 2a 73 65 63 44 65 73 63     BYTE *secDesc
0310: 20 3d 20 30 3b 0a 2b 20 20 20 20 44 57 4f 52 44   = 0;.+    DWORD
0320: 20 73 65 63 44 65 73 63 4c 65 6e 3b 0a 2b 0a 2b   secDescLen;.+.+
0330: 20 20 20 20 63 6f 6e 73 74 20 42 4f 4f 4c 20 73      const BOOL s
0340: 65 74 5f 72 65 61 64 4f 6e 6c 79 20 3d 20 21 28  et_readOnly = !(
0350: 70 6d 6f 64 65 20 26 20 30 32 32 32 29 3b 0a 2b  pmode & 0222);.+
0360: 20 20 20 20 42 4f 4f 4c 20 61 63 6c 5f 72 65 61      BOOL acl_rea
0370: 64 4f 6e 6c 79 5f 66 6f 75 6e 64 20 3d 20 46 41  dOnly_found = FA
0380: 4c 53 45 3b 0a 2b 0a 2b 20 20 20 20 41 43 4c 5f  LSE;.+.+    ACL_
0390: 53 49 5a 45 5f 49 4e 46 4f 52 4d 41 54 49 4f 4e  SIZE_INFORMATION
03a0: 20 41 43 4c 53 69 7a 65 3b 0a 2b 20 20 20 20 42   ACLSize;.+    B
03b0: 4f 4f 4c 20 63 75 72 41 63 6c 50 72 65 73 65 6e  OOL curAclPresen
03c0: 74 2c 20 63 75 72 41 63 6c 44 65 66 61 75 6c 74  t, curAclDefault
03d0: 65 64 3b 0a 2b 20 20 20 20 50 41 43 4c 20 63 75  ed;.+    PACL cu
03e0: 72 41 63 6c 3b 20 0a 2b 20 20 20 20 50 41 43 4c  rAcl; .+    PACL
03f0: 20 6e 65 77 41 63 6c 20 3d 20 30 3b 0a 2b 20 20   newAcl = 0;.+  
0400: 20 20 44 57 4f 52 44 20 6e 65 77 41 63 6c 53 69    DWORD newAclSi
0410: 7a 65 3b 0a 2b 0a 2b 20 20 20 20 57 4f 52 44 20  ze;.+.+    WORD 
0420: 6a 3b 0a 2b 20 20 0a 2b 20 20 20 20 44 57 4f 52  j;.+  .+    DWOR
0430: 44 20 75 73 65 72 53 69 64 4c 65 6e 20 3d 20 34  D userSidLen = 4
0440: 30 39 36 3b 0a 2b 20 20 20 20 53 49 44 20 2a 75  096;.+    SID *u
0450: 73 65 72 53 69 64 20 3d 20 30 3b 0a 2b 20 20 20  serSid = 0;.+   
0460: 20 44 57 4f 52 44 20 75 73 65 72 44 6f 6d 61 69   DWORD userDomai
0470: 6e 4c 65 6e 20 3d 20 33 32 3b 0a 2b 20 20 20 20  nLen = 32;.+    
0480: 54 43 48 41 52 20 2a 75 73 65 72 44 6f 6d 61 69  TCHAR *userDomai
0490: 6e 20 3d 20 30 3b 0a 2b 20 20 20 20 53 49 44 5f  n = 0;.+    SID_
04a0: 4e 41 4d 45 5f 55 53 45 20 75 73 65 72 53 69 64  NAME_USE userSid
04b0: 55 73 65 3b 0a 2b 0a 2b 20 20 20 20 44 57 4f 52  Use;.+.+    DWOR
04c0: 44 20 61 74 74 72 3b 0a 2b 0a 2b 20 20 20 20 69  D attr;.+.+    i
04d0: 6e 74 20 72 65 73 20 3d 20 30 3b 0a 2b 0a 2b 20  nt res = 0;.+.+ 
04e0: 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 4f 6e     /*.+     * On
04f0: 65 20 74 69 6d 65 20 69 6e 69 74 69 61 6c 69 7a  e time initializ
0500: 61 74 69 6f 6e 2c 20 64 79 6e 61 6d 69 63 61 6c  ation, dynamical
0510: 6c 79 20 6c 6f 61 64 20 57 69 6e 64 6f 77 73 20  ly load Windows 
0520: 4e 54 20 66 65 61 74 75 72 65 73 0a 2b 20 20 20  NT features.+   
0530: 20 20 2a 2f 0a 2b 20 20 20 20 74 79 70 65 64 65    */.+    typede
0540: 66 20 44 57 4f 52 44 20 28 57 49 4e 41 50 49 20  f DWORD (WINAPI 
0550: 2a 73 65 74 4e 61 6d 65 64 53 65 63 75 72 69 74  *setNamedSecurit
0560: 79 49 6e 66 6f 41 44 65 66 29 28 20 49 4e 20 4c  yInfoADef)( IN L
0570: 50 53 54 52 2c 0a 2b 20 20 20 20 20 20 49 4e 20  PSTR,.+      IN 
0580: 53 45 5f 4f 42 4a 45 43 54 5f 54 59 50 45 2c 20  SE_OBJECT_TYPE, 
0590: 49 4e 20 53 45 43 55 52 49 54 59 5f 49 4e 46 4f  IN SECURITY_INFO
05a0: 52 4d 41 54 49 4f 4e 2c 20 49 4e 20 50 53 49 44  RMATION, IN PSID
05b0: 2c 20 49 4e 20 50 53 49 44 2c 0a 2b 20 20 20 20  , IN PSID,.+    
05c0: 20 20 49 4e 20 50 41 43 4c 2c 20 49 4e 20 50 41    IN PACL, IN PA
05d0: 43 4c 20 29 3b 0a 2b 20 20 20 20 74 79 70 65 64  CL );.+    typed
05e0: 65 66 20 42 4f 4f 4c 20 28 57 49 4e 41 50 49 20  ef BOOL (WINAPI 
05f0: 2a 67 65 74 41 63 65 44 65 66 29 20 28 50 41 43  *getAceDef) (PAC
0600: 4c 2c 20 44 57 4f 52 44 2c 20 4c 50 56 4f 49 44  L, DWORD, LPVOID
0610: 20 2a 29 3b 0a 2b 20 20 20 20 74 79 70 65 64 65   *);.+    typede
0620: 66 20 42 4f 4f 4c 20 28 57 49 4e 41 50 49 20 2a  f BOOL (WINAPI *
0630: 61 64 64 41 63 65 44 65 66 29 20 28 20 50 41 43  addAceDef) ( PAC
0640: 4c 2c 20 44 57 4f 52 44 2c 20 44 57 4f 52 44 2c  L, DWORD, DWORD,
0650: 20 4c 50 56 4f 49 44 2c 20 44 57 4f 52 44 20 29   LPVOID, DWORD )
0660: 3b 0a 2b 20 20 20 20 74 79 70 65 64 65 66 20 42  ;.+    typedef B
0670: 4f 4f 4c 20 28 57 49 4e 41 50 49 20 2a 65 71 75  OOL (WINAPI *equ
0680: 61 6c 53 69 64 44 65 66 29 20 28 20 50 53 49 44  alSidDef) ( PSID
0690: 2c 20 50 53 49 44 20 29 3b 0a 2b 20 20 20 20 74  , PSID );.+    t
06a0: 79 70 65 64 65 66 20 42 4f 4f 4c 20 28 57 49 4e  ypedef BOOL (WIN
06b0: 41 50 49 20 2a 61 64 64 41 63 63 65 73 73 44 65  API *addAccessDe
06c0: 6e 69 65 64 41 63 65 44 65 66 29 20 28 20 50 41  niedAceDef) ( PA
06d0: 43 4c 2c 20 44 57 4f 52 44 2c 20 44 57 4f 52 44  CL, DWORD, DWORD
06e0: 2c 20 50 53 49 44 20 29 3b 0a 2b 20 20 20 20 74  , PSID );.+    t
06f0: 79 70 65 64 65 66 20 42 4f 4f 4c 20 28 57 49 4e  ypedef BOOL (WIN
0700: 41 50 49 20 2a 69 6e 69 74 69 61 6c 69 7a 65 41  API *initializeA
0710: 63 6c 44 65 66 29 20 28 20 50 41 43 4c 2c 20 44  clDef) ( PACL, D
0720: 57 4f 52 44 2c 20 44 57 4f 52 44 20 29 3b 0a 2b  WORD, DWORD );.+
0730: 20 20 20 20 74 79 70 65 64 65 66 20 44 57 4f 52      typedef DWOR
0740: 44 20 28 57 49 4e 41 50 49 20 2a 67 65 74 4c 65  D (WINAPI *getLe
0750: 6e 67 74 68 53 69 64 44 65 66 29 20 28 20 50 53  ngthSidDef) ( PS
0760: 49 44 20 29 3b 0a 2b 20 20 20 20 74 79 70 65 64  ID );.+    typed
0770: 65 66 20 42 4f 4f 4c 20 28 57 49 4e 41 50 49 20  ef BOOL (WINAPI 
0780: 2a 67 65 74 41 63 6c 49 6e 66 6f 72 6d 61 74 69  *getAclInformati
0790: 6f 6e 44 65 66 29 20 28 50 41 43 4c 2c 20 4c 50  onDef) (PACL, LP
07a0: 56 4f 49 44 2c 20 44 57 4f 52 44 2c 20 0a 2b 20  VOID, DWORD, .+ 
07b0: 20 20 20 20 20 41 43 4c 5f 49 4e 46 4f 52 4d 41       ACL_INFORMA
07c0: 54 49 4f 4e 5f 43 4c 41 53 53 20 29 3b 0a 2b 20  TION_CLASS );.+ 
07d0: 20 20 20 74 79 70 65 64 65 66 20 42 4f 4f 4c 20     typedef BOOL 
07e0: 28 57 49 4e 41 50 49 20 2a 67 65 74 53 65 63 75  (WINAPI *getSecu
07f0: 72 69 74 79 44 65 73 63 72 69 70 74 6f 72 44 61  rityDescriptorDa
0800: 63 6c 44 65 66 29 20 28 50 53 45 43 55 52 49 54  clDef) (PSECURIT
0810: 59 5f 44 45 53 43 52 49 50 54 4f 52 2c 0a 2b 20  Y_DESCRIPTOR,.+ 
0820: 20 20 20 20 20 4c 50 42 4f 4f 4c 2c 20 50 41 43       LPBOOL, PAC
0830: 4c 20 2a 2c 20 4c 50 42 4f 4f 4c 20 29 3b 0a 2b  L *, LPBOOL );.+
0840: 20 20 20 20 74 79 70 65 64 65 66 20 42 4f 4f 4c      typedef BOOL
0850: 20 28 57 49 4e 41 50 49 20 2a 6c 6f 6f 6b 75 70   (WINAPI *lookup
0860: 41 63 63 6f 75 6e 74 4e 61 6d 65 41 44 65 66 29  AccountNameADef)
0870: 20 28 20 4c 50 43 53 54 52 2c 20 4c 50 43 53 54   ( LPCSTR, LPCST
0880: 52 2c 20 50 53 49 44 2c 20 0a 2b 20 20 20 20 20  R, PSID, .+     
0890: 20 50 44 57 4f 52 44 2c 20 4c 50 53 54 52 2c 20   PDWORD, LPSTR, 
08a0: 4c 50 44 57 4f 52 44 2c 20 50 53 49 44 5f 4e 41  LPDWORD, PSID_NA
08b0: 4d 45 5f 55 53 45 20 29 3b 0a 2b 20 20 20 20 74  ME_USE );.+    t
08c0: 79 70 65 64 65 66 20 42 4f 4f 4c 20 28 57 49 4e  ypedef BOOL (WIN
08d0: 41 50 49 20 2a 67 65 74 46 69 6c 65 53 65 63 75  API *getFileSecu
08e0: 72 69 74 79 41 44 65 66 29 20 28 20 4c 50 43 53  rityADef) ( LPCS
08f0: 54 52 2c 20 53 45 43 55 52 49 54 59 5f 49 4e 46  TR, SECURITY_INF
0900: 4f 52 4d 41 54 49 4f 4e 2c 0a 2b 20 20 20 20 20  ORMATION,.+     
0910: 20 50 53 45 43 55 52 49 54 59 5f 44 45 53 43 52   PSECURITY_DESCR
0920: 49 50 54 4f 52 2c 20 44 57 4f 52 44 2c 20 4c 50  IPTOR, DWORD, LP
0930: 44 57 4f 52 44 20 29 3b 0a 2b 0a 2b 20 20 20 20  DWORD );.+.+    
0940: 73 74 61 74 69 63 20 73 65 74 4e 61 6d 65 64 53  static setNamedS
0950: 65 63 75 72 69 74 79 49 6e 66 6f 41 44 65 66 20  ecurityInfoADef 
0960: 73 65 74 4e 61 6d 65 64 53 65 63 75 72 69 74 79  setNamedSecurity
0970: 49 6e 66 6f 50 72 6f 63 3b 0a 2b 20 20 20 20 73  InfoProc;.+    s
0980: 74 61 74 69 63 20 67 65 74 41 63 65 44 65 66 20  tatic getAceDef 
0990: 67 65 74 41 63 65 50 72 6f 63 3b 0a 2b 20 20 20  getAceProc;.+   
09a0: 20 73 74 61 74 69 63 20 61 64 64 41 63 65 44 65   static addAceDe
09b0: 66 20 61 64 64 41 63 65 50 72 6f 63 3b 0a 2b 20  f addAceProc;.+ 
09c0: 20 20 20 73 74 61 74 69 63 20 65 71 75 61 6c 53     static equalS
09d0: 69 64 44 65 66 20 65 71 75 61 6c 53 69 64 50 72  idDef equalSidPr
09e0: 6f 63 3b 0a 2b 20 20 20 20 73 74 61 74 69 63 20  oc;.+    static 
09f0: 61 64 64 41 63 63 65 73 73 44 65 6e 69 65 64 41  addAccessDeniedA
0a00: 63 65 44 65 66 20 61 64 64 41 63 63 65 73 73 44  ceDef addAccessD
0a10: 65 6e 69 65 64 41 63 65 50 72 6f 63 3b 0a 2b 20  eniedAceProc;.+ 
0a20: 20 20 20 73 74 61 74 69 63 20 69 6e 69 74 69 61     static initia
0a30: 6c 69 7a 65 41 63 6c 44 65 66 20 69 6e 69 74 69  lizeAclDef initi
0a40: 61 6c 69 7a 65 41 63 6c 50 72 6f 63 3b 0a 2b 20  alizeAclProc;.+ 
0a50: 20 20 20 73 74 61 74 69 63 20 67 65 74 4c 65 6e     static getLen
0a60: 67 74 68 53 69 64 44 65 66 20 67 65 74 4c 65 6e  gthSidDef getLen
0a70: 67 74 68 53 69 64 50 72 6f 63 3b 0a 2b 20 20 20  gthSidProc;.+   
0a80: 20 73 74 61 74 69 63 20 67 65 74 41 63 6c 49 6e   static getAclIn
0a90: 66 6f 72 6d 61 74 69 6f 6e 44 65 66 20 67 65 74  formationDef get
0aa0: 41 63 6c 49 6e 66 6f 72 6d 61 74 69 6f 6e 50 72  AclInformationPr
0ab0: 6f 63 3b 0a 2b 20 20 20 20 73 74 61 74 69 63 20  oc;.+    static 
0ac0: 67 65 74 53 65 63 75 72 69 74 79 44 65 73 63 72  getSecurityDescr
0ad0: 69 70 74 6f 72 44 61 63 6c 44 65 66 20 67 65 74  iptorDaclDef get
0ae0: 53 65 63 75 72 69 74 79 44 65 73 63 72 69 70 74  SecurityDescript
0af0: 6f 72 44 61 63 6c 50 72 6f 63 3b 0a 2b 20 20 20  orDaclProc;.+   
0b00: 20 73 74 61 74 69 63 20 6c 6f 6f 6b 75 70 41 63   static lookupAc
0b10: 63 6f 75 6e 74 4e 61 6d 65 41 44 65 66 20 6c 6f  countNameADef lo
0b20: 6f 6b 75 70 41 63 63 6f 75 6e 74 4e 61 6d 65 50  okupAccountNameP
0b30: 72 6f 63 3b 20 0a 2b 20 20 20 20 73 74 61 74 69  roc; .+    stati
0b40: 63 20 67 65 74 46 69 6c 65 53 65 63 75 72 69 74  c getFileSecurit
0b50: 79 41 44 65 66 20 67 65 74 46 69 6c 65 53 65 63  yADef getFileSec
0b60: 75 72 69 74 79 50 72 6f 63 3b 0a 2b 0a 2b 20 20  urityProc;.+.+  
0b70: 20 20 73 74 61 74 69 63 20 69 6e 74 20 69 6e 69    static int ini
0b80: 74 69 61 6c 69 7a 65 64 20 3d 20 30 3b 0a 2b 20  tialized = 0;.+ 
0b90: 20 20 20 69 66 20 28 21 69 6e 69 74 69 61 6c 69     if (!initiali
0ba0: 7a 65 64 29 20 7b 0a 2b 20 20 20 20 20 20 20 20  zed) {.+        
0bb0: 54 43 4c 5f 44 45 43 4c 41 52 45 5f 4d 55 54 45  TCL_DECLARE_MUTE
0bc0: 58 28 69 6e 69 74 69 61 6c 7a 65 4d 75 74 65 78  X(initialzeMutex
0bd0: 29 0a 2b 20 20 20 20 20 20 20 20 54 63 6c 5f 4d  ).+        Tcl_M
0be0: 75 74 65 78 4c 6f 63 6b 28 26 69 6e 69 74 69 61  utexLock(&initia
0bf0: 6c 69 7a 65 4d 75 74 65 78 29 3b 0a 2b 20 20 20  lizeMutex);.+   
0c00: 20 20 20 20 20 69 66 20 28 21 69 6e 69 74 69 61       if (!initia
0c10: 6c 69 7a 65 64 29 20 7b 0a 2b 20 20 20 20 20 20  lized) {.+      
0c20: 20 20 20 20 20 20 48 49 4e 53 54 41 4e 43 45 20        HINSTANCE 
0c30: 68 49 6e 73 74 61 6e 63 65 20 3d 20 4c 6f 61 64  hInstance = Load
0c40: 4c 69 62 72 61 72 79 28 22 41 64 76 61 70 69 33  Library("Advapi3
0c50: 32 22 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20  2");.+          
0c60: 20 20 69 66 20 28 68 49 6e 73 74 61 6e 63 65 20    if (hInstance 
0c70: 21 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 20 20 20 20  != NULL) {.+    
0c80: 20 20 20 20 20 20 20 20 20 20 20 20 73 65 74 4e              setN
0c90: 61 6d 65 64 53 65 63 75 72 69 74 79 49 6e 66 6f  amedSecurityInfo
0ca0: 50 72 6f 63 20 3d 20 28 73 65 74 4e 61 6d 65 64  Proc = (setNamed
0cb0: 53 65 63 75 72 69 74 79 49 6e 66 6f 41 44 65 66  SecurityInfoADef
0cc0: 29 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 20  ).+             
0cd0: 20 20 20 20 20 47 65 74 50 72 6f 63 41 64 64 72       GetProcAddr
0ce0: 65 73 73 28 68 49 6e 73 74 61 6e 63 65 2c 20 22  ess(hInstance, "
0cf0: 53 65 74 4e 61 6d 65 64 53 65 63 75 72 69 74 79  SetNamedSecurity
0d00: 49 6e 66 6f 41 22 29 3b 0a 2b 20 20 20 20 20 20  InfoA");.+      
0d10: 20 20 20 20 20 20 20 20 20 20 67 65 74 46 69 6c            getFil
0d20: 65 53 65 63 75 72 69 74 79 50 72 6f 63 20 3d 20  eSecurityProc = 
0d30: 28 67 65 74 46 69 6c 65 53 65 63 75 72 69 74 79  (getFileSecurity
0d40: 41 44 65 66 29 0a 2b 20 20 20 20 20 20 20 20 20  ADef).+         
0d50: 20 20 20 20 20 20 20 20 20 47 65 74 50 72 6f 63           GetProc
0d60: 41 64 64 72 65 73 73 28 68 49 6e 73 74 61 6e 63  Address(hInstanc
0d70: 65 2c 20 22 47 65 74 46 69 6c 65 53 65 63 75 72  e, "GetFileSecur
0d80: 69 74 79 41 22 29 3b 0a 2b 20 20 20 20 20 20 20  ityA");.+       
0d90: 20 20 20 20 20 20 20 20 20 67 65 74 41 63 65 50           getAceP
0da0: 72 6f 63 20 3d 20 28 67 65 74 41 63 65 44 65 66  roc = (getAceDef
0db0: 29 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 20  ).+             
0dc0: 20 20 20 20 20 47 65 74 50 72 6f 63 41 64 64 72       GetProcAddr
0dd0: 65 73 73 28 68 49 6e 73 74 61 6e 63 65 2c 20 22  ess(hInstance, "
0de0: 47 65 74 41 63 65 22 29 3b 0a 2b 20 20 20 20 20  GetAce");.+     
0df0: 20 20 20 20 20 20 20 20 20 20 20 61 64 64 41 63             addAc
0e00: 65 50 72 6f 63 20 3d 20 28 61 64 64 41 63 65 44  eProc = (addAceD
0e10: 65 66 29 0a 2b 20 20 20 20 20 20 20 20 20 20 20  ef).+           
0e20: 20 20 20 20 20 20 20 47 65 74 50 72 6f 63 41 64         GetProcAd
0e30: 64 72 65 73 73 28 68 49 6e 73 74 61 6e 63 65 2c  dress(hInstance,
0e40: 20 22 41 64 64 41 63 65 22 29 3b 0a 2b 20 20 20   "AddAce");.+   
0e50: 20 20 20 20 20 20 20 20 20 20 20 20 20 65 71 75               equ
0e60: 61 6c 53 69 64 50 72 6f 63 20 3d 20 28 65 71 75  alSidProc = (equ
0e70: 61 6c 53 69 64 44 65 66 29 0a 2b 20 20 20 20 20  alSidDef).+     
0e80: 20 20 20 20 20 20 20 20 20 20 20 20 20 47 65 74               Get
0e90: 50 72 6f 63 41 64 64 72 65 73 73 28 68 49 6e 73  ProcAddress(hIns
0ea0: 74 61 6e 63 65 2c 20 22 45 71 75 61 6c 53 69 64  tance, "EqualSid
0eb0: 22 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20  ");.+           
0ec0: 20 20 20 20 20 61 64 64 41 63 63 65 73 73 44 65       addAccessDe
0ed0: 6e 69 65 64 41 63 65 50 72 6f 63 20 3d 20 28 61  niedAceProc = (a
0ee0: 64 64 41 63 63 65 73 73 44 65 6e 69 65 64 41 63  ddAccessDeniedAc
0ef0: 65 44 65 66 29 0a 2b 20 20 20 20 20 20 20 20 20  eDef).+         
0f00: 20 20 20 20 20 20 20 20 20 47 65 74 50 72 6f 63           GetProc
0f10: 41 64 64 72 65 73 73 28 68 49 6e 73 74 61 6e 63  Address(hInstanc
0f20: 65 2c 20 22 41 64 64 41 63 63 65 73 73 44 65 6e  e, "AddAccessDen
0f30: 69 65 64 41 63 65 22 29 3b 0a 2b 20 20 20 20 20  iedAce");.+     
0f40: 20 20 20 20 20 20 20 20 20 20 20 69 6e 69 74 69             initi
0f50: 61 6c 69 7a 65 41 63 6c 50 72 6f 63 20 3d 20 28  alizeAclProc = (
0f60: 69 6e 69 74 69 61 6c 69 7a 65 41 63 6c 44 65 66  initializeAclDef
0f70: 29 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 20  ).+             
0f80: 20 20 20 20 20 47 65 74 50 72 6f 63 41 64 64 72       GetProcAddr
0f90: 65 73 73 28 68 49 6e 73 74 61 6e 63 65 2c 20 22  ess(hInstance, "
0fa0: 49 6e 69 74 69 61 6c 69 7a 65 41 63 6c 22 29 3b  InitializeAcl");
0fb0: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .+              
0fc0: 20 20 67 65 74 4c 65 6e 67 74 68 53 69 64 50 72    getLengthSidPr
0fd0: 6f 63 20 3d 20 28 67 65 74 4c 65 6e 67 74 68 53  oc = (getLengthS
0fe0: 69 64 44 65 66 29 0a 2b 20 20 20 20 20 20 20 20  idDef).+        
0ff0: 20 20 20 20 20 20 20 20 20 20 47 65 74 50 72 6f            GetPro
1000: 63 41 64 64 72 65 73 73 28 68 49 6e 73 74 61 6e  cAddress(hInstan
1010: 63 65 2c 20 22 47 65 74 4c 65 6e 67 74 68 53 69  ce, "GetLengthSi
1020: 64 22 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20  d");.+          
1030: 20 20 20 20 20 20 67 65 74 41 63 6c 49 6e 66 6f        getAclInfo
1040: 72 6d 61 74 69 6f 6e 50 72 6f 63 20 3d 20 28 67  rmationProc = (g
1050: 65 74 41 63 6c 49 6e 66 6f 72 6d 61 74 69 6f 6e  etAclInformation
1060: 44 65 66 29 0a 2b 20 20 20 20 20 20 20 20 20 20  Def).+          
1070: 20 20 20 20 20 20 20 20 47 65 74 50 72 6f 63 41          GetProcA
1080: 64 64 72 65 73 73 28 68 49 6e 73 74 61 6e 63 65  ddress(hInstance
1090: 2c 20 22 47 65 74 41 63 6c 49 6e 66 6f 72 6d 61  , "GetAclInforma
10a0: 74 69 6f 6e 22 29 3b 0a 2b 20 20 20 20 20 20 20  tion");.+       
10b0: 20 20 20 20 20 20 20 20 20 67 65 74 53 65 63 75           getSecu
10c0: 72 69 74 79 44 65 73 63 72 69 70 74 6f 72 44 61  rityDescriptorDa
10d0: 63 6c 50 72 6f 63 20 3d 20 28 67 65 74 53 65 63  clProc = (getSec
10e0: 75 72 69 74 79 44 65 73 63 72 69 70 74 6f 72 44  urityDescriptorD
10f0: 61 63 6c 44 65 66 29 0a 2b 20 20 20 20 20 20 20  aclDef).+       
1100: 20 20 20 20 20 20 20 20 20 20 20 47 65 74 50 72             GetPr
1110: 6f 63 41 64 64 72 65 73 73 28 68 49 6e 73 74 61  ocAddress(hInsta
1120: 6e 63 65 2c 20 22 47 65 74 53 65 63 75 72 69 74  nce, "GetSecurit
1130: 79 44 65 73 63 72 69 70 74 6f 72 44 61 63 6c 22  yDescriptorDacl"
1140: 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20  );.+            
1150: 20 20 20 20 6c 6f 6f 6b 75 70 41 63 63 6f 75 6e      lookupAccoun
1160: 74 4e 61 6d 65 50 72 6f 63 20 3d 20 28 6c 6f 6f  tNameProc = (loo
1170: 6b 75 70 41 63 63 6f 75 6e 74 4e 61 6d 65 41 44  kupAccountNameAD
1180: 65 66 29 0a 2b 20 20 20 20 20 20 20 20 20 20 20  ef).+           
1190: 20 20 20 20 20 20 20 47 65 74 50 72 6f 63 41 64         GetProcAd
11a0: 64 72 65 73 73 28 68 49 6e 73 74 61 6e 63 65 2c  dress(hInstance,
11b0: 20 22 4c 6f 6f 6b 75 70 41 63 63 6f 75 6e 74 4e   "LookupAccountN
11c0: 61 6d 65 41 22 29 3b 0a 2b 20 20 20 20 20 20 20  ameA");.+       
11d0: 20 20 20 20 20 20 20 20 20 69 66 20 28 73 65 74           if (set
11e0: 4e 61 6d 65 64 53 65 63 75 72 69 74 79 49 6e 66  NamedSecurityInf
11f0: 6f 50 72 6f 63 20 26 26 20 67 65 74 41 63 65 50  oProc && getAceP
1200: 72 6f 63 0a 2b 20 20 20 20 20 20 20 20 20 20 20  roc.+           
1210: 20 20 20 20 20 20 20 26 26 20 61 64 64 41 63 65         && addAce
1220: 50 72 6f 63 20 26 26 20 65 71 75 61 6c 53 69 64  Proc && equalSid
1230: 50 72 6f 63 20 26 26 20 61 64 64 41 63 63 65 73  Proc && addAcces
1240: 73 44 65 6e 69 65 64 41 63 65 50 72 6f 63 0a 2b  sDeniedAceProc.+
1250: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1260: 20 20 26 26 20 69 6e 69 74 69 61 6c 69 7a 65 41    && initializeA
1270: 63 6c 50 72 6f 63 20 26 26 20 67 65 74 4c 65 6e  clProc && getLen
1280: 67 74 68 53 69 64 50 72 6f 63 0a 2b 20 20 20 20  gthSidProc.+    
1290: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 26 26                &&
12a0: 20 67 65 74 41 63 6c 49 6e 66 6f 72 6d 61 74 69   getAclInformati
12b0: 6f 6e 50 72 6f 63 20 26 26 20 67 65 74 53 65 63  onProc && getSec
12c0: 75 72 69 74 79 44 65 73 63 72 69 70 74 6f 72 44  urityDescriptorD
12d0: 61 63 6c 50 72 6f 63 0a 2b 20 20 20 20 20 20 20  aclProc.+       
12e0: 20 20 20 20 20 20 20 20 20 20 20 26 26 20 6c 6f             && lo
12f0: 6f 6b 75 70 41 63 63 6f 75 6e 74 4e 61 6d 65 50  okupAccountNameP
1300: 72 6f 63 20 26 26 20 67 65 74 46 69 6c 65 53 65  roc && getFileSe
1310: 63 75 72 69 74 79 50 72 6f 63 29 0a 2b 20 20 20  curityProc).+   
1320: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1330: 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 3d 20 31   initialized = 1
1340: 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 7d  ;.+            }
1350: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 69 66  .+            if
1360: 20 28 21 69 6e 69 74 69 61 6c 69 7a 65 64 29 0a   (!initialized).
1370: 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  +               
1380: 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 3d 20 2d   initialized = -
1390: 31 3b 0a 2b 20 20 20 20 20 20 20 20 7d 0a 2b 20  1;.+        }.+ 
13a0: 20 20 20 20 20 20 20 54 63 6c 5f 4d 75 74 65 78         Tcl_Mutex
13b0: 55 6e 6c 6f 63 6b 28 26 69 6e 74 69 61 6c 69 7a  Unlock(&intializ
13c0: 65 4d 75 74 65 78 29 3b 0a 2b 20 20 20 20 7d 0a  eMutex);.+    }.
13d0: 2b 0a 2b 20 20 20 20 2f 2a 20 50 72 6f 63 65 73  +.+    /* Proces
13e0: 73 20 74 68 65 20 63 68 6d 6f 64 20 72 65 71 75  s the chmod requ
13f0: 65 73 74 20 2a 2f 0a 2b 20 20 20 20 61 74 74 72  est */.+    attr
1400: 20 3d 20 47 65 74 46 69 6c 65 41 74 74 72 69 62   = GetFileAttrib
1410: 75 74 65 73 28 6e 61 74 69 76 65 50 61 74 68 29  utes(nativePath)
1420: 3b 0a 2b 0a 2b 20 20 20 20 2f 2a 20 6e 61 74 69  ;.+.+    /* nati
1430: 76 65 50 61 74 68 20 6e 6f 74 20 66 6f 75 6e 64  vePath not found
1440: 20 2a 2f 0a 2b 20 20 20 20 69 66 20 28 61 74 74   */.+    if (att
1450: 72 20 3d 3d 20 30 78 66 66 66 66 66 66 66 66 29  r == 0xffffffff)
1460: 20 7b 0a 2b 20 20 20 20 20 20 20 20 72 65 73 20   {.+        res 
1470: 3d 20 2d 31 3b 0a 2b 20 20 20 20 20 20 20 20 67  = -1;.+        g
1480: 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 20 20 20 20 7d  oto done;.+    }
1490: 0a 2b 0a 2b 20 20 20 20 2f 2a 20 49 66 20 6e 6f  .+.+    /* If no
14a0: 20 41 43 4c 20 41 50 49 20 69 73 20 70 72 65 73   ACL API is pres
14b0: 65 6e 74 20 6f 72 20 6e 61 74 69 76 65 50 61 74  ent or nativePat
14c0: 68 20 69 73 20 6e 6f 74 20 61 20 64 69 72 65 63  h is not a direc
14d0: 74 6f 72 79 2c 20 0a 2b 20 20 20 20 20 2a 20 74  tory, .+     * t
14e0: 68 65 72 65 20 69 73 20 6e 6f 20 73 70 65 63 69  here is no speci
14f0: 61 6c 20 68 61 6e 64 6c 69 6e 67 20 0a 2b 20 20  al handling .+  
1500: 20 20 20 2a 2f 0a 2b 20 20 20 20 69 66 20 28 69     */.+    if (i
1510: 6e 69 74 69 61 6c 69 7a 65 64 20 3c 20 30 20 7c  nitialized < 0 |
1520: 7c 20 21 28 61 74 74 72 20 26 20 46 49 4c 45 5f  | !(attr & FILE_
1530: 41 54 54 52 49 42 55 54 45 5f 44 49 52 45 43 54  ATTRIBUTE_DIRECT
1540: 4f 52 59 29 29 0a 2b 20 20 20 20 20 20 20 20 67  ORY)).+        g
1550: 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 0a 2b 20 20 20  oto done;.+.+   
1560: 20 2f 2a 20 53 65 74 20 74 68 65 20 72 65 73 75   /* Set the resu
1570: 6c 74 20 74 6f 20 65 72 72 6f 72 2c 20 69 66 20  lt to error, if 
1580: 74 68 65 20 41 43 4c 20 63 68 61 6e 67 65 20 69  the ACL change i
1590: 73 20 73 75 63 63 65 73 73 66 75 6c 20 69 74 20  s successful it 
15a0: 77 69 6c 6c 20 0a 2b 20 20 20 20 20 2a 20 20 62  will .+     *  b
15b0: 65 20 72 65 73 65 74 20 74 6f 20 30 20 0a 2b 20  e reset to 0 .+ 
15c0: 20 20 20 20 2a 2f 0a 2b 20 20 20 20 72 65 73 20      */.+    res 
15d0: 3d 20 2d 31 3b 0a 2b 0a 2b 20 20 20 20 2f 2a 0a  = -1;.+.+    /*.
15e0: 2b 20 20 20 20 20 2a 20 52 65 61 64 20 74 68 65  +     * Read the
15f0: 20 73 65 63 75 72 69 74 79 20 64 65 73 63 72 69   security descri
1600: 70 74 6f 72 20 66 6f 72 20 74 68 65 20 64 69 72  ptor for the dir
1610: 65 63 74 6f 72 79 2e 20 4e 6f 74 65 20 74 68 65  ectory. Note the
1620: 0a 2b 20 20 20 20 20 2a 20 66 69 72 73 74 20 63  .+     * first c
1630: 61 6c 6c 20 6f 62 74 61 69 6e 73 20 74 68 65 20  all obtains the 
1640: 73 69 7a 65 20 6f 66 20 74 68 65 20 73 65 63 75  size of the secu
1650: 72 69 74 79 20 64 65 73 63 72 69 70 74 6f 72 2e  rity descriptor.
1660: 0a 2b 20 20 20 20 20 2a 2f 0a 2b 20 20 20 20 69  .+     */.+    i
1670: 66 20 28 21 67 65 74 46 69 6c 65 53 65 63 75 72  f (!getFileSecur
1680: 69 74 79 50 72 6f 63 28 6e 61 74 69 76 65 50 61  ityProc(nativePa
1690: 74 68 2c 20 69 6e 66 6f 42 69 74 73 2c 20 4e 55  th, infoBits, NU
16a0: 4c 4c 2c 20 30 2c 20 26 73 65 63 44 65 73 63 4c  LL, 0, &secDescL
16b0: 65 6e 29 29 20 7b 0a 2b 20 20 20 20 20 20 20 20  en)) {.+        
16c0: 69 66 20 28 47 65 74 4c 61 73 74 45 72 72 6f 72  if (GetLastError
16d0: 28 29 20 3d 3d 20 45 52 52 4f 52 5f 49 4e 53 55  () == ERROR_INSU
16e0: 46 46 49 43 49 45 4e 54 5f 42 55 46 46 45 52 29  FFICIENT_BUFFER)
16f0: 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20   {.+            
1700: 44 57 4f 52 44 20 73 65 63 44 65 73 63 4c 65 6e  DWORD secDescLen
1710: 32 20 3d 20 30 3b 0a 2b 20 20 20 20 20 20 20 20  2 = 0;.+        
1720: 20 20 20 20 73 65 63 44 65 73 63 20 3d 20 28 42      secDesc = (B
1730: 59 54 45 20 2a 29 20 63 6b 61 6c 6c 6f 63 28 73  YTE *) ckalloc(s
1740: 65 63 44 65 73 63 4c 65 6e 29 3b 0a 2b 20 20 20  ecDescLen);.+   
1750: 20 20 20 20 20 20 20 20 20 69 66 20 28 21 67 65           if (!ge
1760: 74 46 69 6c 65 53 65 63 75 72 69 74 79 50 72 6f  tFileSecurityPro
1770: 63 28 6e 61 74 69 76 65 50 61 74 68 2c 20 69 6e  c(nativePath, in
1780: 66 6f 42 69 74 73 2c 20 73 65 63 44 65 73 63 2c  foBits, secDesc,
1790: 20 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 20   .+             
17a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
17b0: 20 20 20 20 20 20 20 20 73 65 63 44 65 73 63 4c          secDescL
17c0: 65 6e 2c 20 26 73 65 63 44 65 73 63 4c 65 6e 32  en, &secDescLen2
17d0: 29 20 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20  ) .+            
17e0: 20 20 20 20 7c 7c 20 28 73 65 63 44 65 73 63 4c      || (secDescL
17f0: 65 6e 20 3c 20 73 65 63 44 65 73 63 4c 65 6e 32  en < secDescLen2
1800: 29 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20  )) {.+          
1810: 20 20 20 20 20 20 67 6f 74 6f 20 64 6f 6e 65 3b        goto done;
1820: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a  .+            }.
1830: 2b 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20  +        } else 
1840: 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 67  {.+            g
1850: 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 20 20 20 20 20  oto done;.+     
1860: 20 20 20 7d 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20     }.+    }.+.+ 
1870: 20 20 20 2f 2a 20 47 65 74 20 74 68 65 20 22 45     /* Get the "E
1880: 76 65 72 79 6f 6e 65 22 20 53 49 44 20 2a 2f 0a  veryone" SID */.
1890: 2b 20 20 20 20 75 73 65 72 53 69 64 20 3d 20 28  +    userSid = (
18a0: 53 49 44 20 2a 29 20 63 6b 61 6c 6c 6f 63 28 75  SID *) ckalloc(u
18b0: 73 65 72 53 69 64 4c 65 6e 29 3b 0a 2b 20 20 20  serSidLen);.+   
18c0: 20 75 73 65 72 44 6f 6d 61 69 6e 20 3d 20 28 54   userDomain = (T
18d0: 43 48 41 52 20 2a 29 20 63 6b 61 6c 6c 6f 63 28  CHAR *) ckalloc(
18e0: 75 73 65 72 44 6f 6d 61 69 6e 4c 65 6e 29 3b 0a  userDomainLen);.
18f0: 2b 20 20 20 20 69 66 20 28 21 6c 6f 6f 6b 75 70  +    if (!lookup
1900: 41 63 63 6f 75 6e 74 4e 61 6d 65 50 72 6f 63 28  AccountNameProc(
1910: 4e 55 4c 4c 2c 20 65 76 65 72 79 6f 6e 65 42 75  NULL, everyoneBu
1920: 66 2c 20 75 73 65 72 53 69 64 2c 20 26 75 73 65  f, userSid, &use
1930: 72 53 69 64 4c 65 6e 2c 20 0a 2b 20 20 20 20 20  rSidLen, .+     
1940: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
1950: 20 20 20 20 20 20 20 20 20 20 75 73 65 72 44 6f            userDo
1960: 6d 61 69 6e 2c 20 26 75 73 65 72 44 6f 6d 61 69  main, &userDomai
1970: 6e 4c 65 6e 2c 20 26 75 73 65 72 53 69 64 55 73  nLen, &userSidUs
1980: 65 29 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 69  e)) {.+        i
1990: 66 20 28 47 65 74 4c 61 73 74 45 72 72 6f 72 28  f (GetLastError(
19a0: 29 20 3d 3d 20 45 52 52 4f 52 5f 49 4e 53 55 46  ) == ERROR_INSUF
19b0: 46 49 43 49 45 4e 54 5f 42 55 46 46 45 52 29 20  FICIENT_BUFFER) 
19c0: 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 63  {.+            c
19d0: 6b 66 72 65 65 28 28 63 68 61 72 20 2a 29 75 73  kfree((char *)us
19e0: 65 72 53 69 64 29 3b 0a 2b 20 20 20 20 20 20 20  erSid);.+       
19f0: 20 20 20 20 20 75 73 65 72 53 69 64 20 3d 20 28       userSid = (
1a00: 53 49 44 20 2a 29 20 63 6b 61 6c 6c 6f 63 28 75  SID *) ckalloc(u
1a10: 73 65 72 53 69 64 4c 65 6e 29 3b 0a 2b 20 20 20  serSidLen);.+   
1a20: 20 20 20 20 20 20 20 20 20 63 6b 66 72 65 65 28           ckfree(
1a30: 75 73 65 72 44 6f 6d 61 69 6e 29 3b 0a 2b 20 20  userDomain);.+  
1a40: 20 20 20 20 20 20 20 20 20 20 75 73 65 72 44 6f            userDo
1a50: 6d 61 69 6e 20 3d 20 28 54 43 48 41 52 20 2a 29  main = (TCHAR *)
1a60: 20 63 6b 61 6c 6c 6f 63 28 75 73 65 72 44 6f 6d   ckalloc(userDom
1a70: 61 69 6e 4c 65 6e 29 3b 0a 2b 20 20 20 20 20 20  ainLen);.+      
1a80: 20 20 20 20 20 20 69 66 20 28 21 6c 6f 6f 6b 75        if (!looku
1a90: 70 41 63 63 6f 75 6e 74 4e 61 6d 65 50 72 6f 63  pAccountNameProc
1aa0: 28 4e 55 4c 4c 2c 20 65 76 65 72 79 6f 6e 65 42  (NULL, everyoneB
1ab0: 75 66 2c 20 75 73 65 72 53 69 64 2c 20 0a 2b 20  uf, userSid, .+ 
1ac0: 20 20 20 20 20 20 20 20 20 20 20 20 20 26 75 73               &us
1ad0: 65 72 53 69 64 4c 65 6e 2c 20 75 73 65 72 44 6f  erSidLen, userDo
1ae0: 6d 61 69 6e 2c 20 26 75 73 65 72 44 6f 6d 61 69  main, &userDomai
1af0: 6e 4c 65 6e 2c 20 26 75 73 65 72 53 69 64 55 73  nLen, &userSidUs
1b00: 65 29 29 0a 2b 20 20 20 20 20 20 20 20 20 20 20  e)).+           
1b10: 20 20 20 20 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a       goto done;.
1b20: 2b 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 0a  +        } else.
1b30: 2b 20 20 20 20 20 20 20 20 20 20 20 20 67 6f 74  +            got
1b40: 6f 20 64 6f 6e 65 3b 0a 2b 20 20 20 20 7d 0a 2b  o done;.+    }.+
1b50: 0a 2b 20 20 20 20 2f 2a 20 49 66 20 63 75 72 41  .+    /* If curA
1b60: 63 6c 50 72 65 73 65 6e 74 20 3d 3d 20 66 61 6c  clPresent == fal
1b70: 73 65 20 74 68 65 6e 20 63 75 72 41 63 6c 20 61  se then curAcl a
1b80: 6e 64 20 63 75 72 41 63 6c 44 65 66 61 75 6c 74  nd curAclDefault
1b90: 65 64 20 6e 6f 74 20 76 61 6c 69 64 20 2a 2f 0a  ed not valid */.
1ba0: 2b 20 20 20 20 69 66 20 28 21 67 65 74 53 65 63  +    if (!getSec
1bb0: 75 72 69 74 79 44 65 73 63 72 69 70 74 6f 72 44  urityDescriptorD
1bc0: 61 63 6c 50 72 6f 63 28 73 65 63 44 65 73 63 2c  aclProc(secDesc,
1bd0: 20 26 63 75 72 41 63 6c 50 72 65 73 65 6e 74 2c   &curAclPresent,
1be0: 20 0a 2b 20 20 20 20 20 20 26 63 75 72 41 63 6c   .+      &curAcl
1bf0: 2c 20 26 63 75 72 41 63 6c 44 65 66 61 75 6c 74  , &curAclDefault
1c00: 65 64 29 29 0a 2b 20 20 20 20 20 20 20 20 67 6f  ed)).+        go
1c10: 74 6f 20 64 6f 6e 65 3b 0a 2b 0a 2b 20 20 20 20  to done;.+.+    
1c20: 69 66 20 28 21 63 75 72 41 63 6c 50 72 65 73 65  if (!curAclPrese
1c30: 6e 74 20 7c 7c 20 21 63 75 72 41 63 6c 29 20 7b  nt || !curAcl) {
1c40: 0a 2b 20 20 20 20 20 20 20 20 41 43 4c 53 69 7a  .+        ACLSiz
1c50: 65 2e 41 63 6c 42 79 74 65 73 49 6e 55 73 65 20  e.AclBytesInUse 
1c60: 3d 20 30 3b 0a 2b 20 20 20 20 20 20 20 20 41 43  = 0;.+        AC
1c70: 4c 53 69 7a 65 2e 41 63 65 43 6f 75 6e 74 20 3d  LSize.AceCount =
1c80: 20 30 3b 0a 2b 20 20 20 20 7d 20 65 6c 73 65 20   0;.+    } else 
1c90: 69 66 20 28 21 67 65 74 41 63 6c 49 6e 66 6f 72  if (!getAclInfor
1ca0: 6d 61 74 69 6f 6e 50 72 6f 63 28 63 75 72 41 63  mationProc(curAc
1cb0: 6c 2c 20 26 41 43 4c 53 69 7a 65 2c 20 73 69 7a  l, &ACLSize, siz
1cc0: 65 6f 66 28 41 43 4c 53 69 7a 65 29 2c 20 0a 2b  eof(ACLSize), .+
1cd0: 20 20 20 20 20 20 41 63 6c 53 69 7a 65 49 6e 66        AclSizeInf
1ce0: 6f 72 6d 61 74 69 6f 6e 29 29 0a 2b 20 20 20 20  ormation)).+    
1cf0: 20 20 20 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 2b      goto done;.+
1d00: 0a 2b 20 20 20 20 2f 2a 20 41 6c 6c 6f 63 61 74  .+    /* Allocat
1d10: 65 20 6d 65 6d 6f 72 79 20 66 6f 72 20 74 68 65  e memory for the
1d20: 20 6e 65 77 20 41 43 4c 20 2a 2f 0a 2b 20 20 20   new ACL */.+   
1d30: 20 6e 65 77 41 63 6c 53 69 7a 65 20 3d 20 41 43   newAclSize = AC
1d40: 4c 53 69 7a 65 2e 41 63 6c 42 79 74 65 73 49 6e  LSize.AclBytesIn
1d50: 55 73 65 20 2b 20 73 69 7a 65 6f 66 20 28 41 43  Use + sizeof (AC
1d60: 43 45 53 53 5f 44 45 4e 49 45 44 5f 41 43 45 29  CESS_DENIED_ACE)
1d70: 20 0a 2b 20 20 20 20 20 20 2b 20 67 65 74 4c 65   .+      + getLe
1d80: 6e 67 74 68 53 69 64 50 72 6f 63 28 75 73 65 72  ngthSidProc(user
1d90: 53 69 64 29 20 2d 20 73 69 7a 65 6f 66 20 28 44  Sid) - sizeof (D
1da0: 57 4f 52 44 29 3b 0a 2b 20 20 20 20 6e 65 77 41  WORD);.+    newA
1db0: 63 6c 20 3d 20 28 41 43 4c 20 2a 29 20 63 6b 61  cl = (ACL *) cka
1dc0: 6c 6c 6f 63 20 28 6e 65 77 41 63 6c 53 69 7a 65  lloc (newAclSize
1dd0: 29 3b 0a 2b 20 20 0a 2b 20 20 20 20 2f 2a 20 49  );.+  .+    /* I
1de0: 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 20 6e 65  nitialize the ne
1df0: 77 20 41 43 4c 20 2a 2f 0a 2b 20 20 20 20 69 66  w ACL */.+    if
1e00: 28 21 69 6e 69 74 69 61 6c 69 7a 65 41 63 6c 50  (!initializeAclP
1e10: 72 6f 63 28 6e 65 77 41 63 6c 2c 20 6e 65 77 41  roc(newAcl, newA
1e20: 63 6c 53 69 7a 65 2c 20 41 43 4c 5f 52 45 56 49  clSize, ACL_REVI
1e30: 53 49 4f 4e 29 29 0a 2b 20 20 20 20 20 20 20 20  SION)).+        
1e40: 67 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 0a 2b 20 20  goto done;.+.+  
1e50: 20 20 2f 2a 20 41 64 64 20 64 65 6e 69 65 64 20    /* Add denied 
1e60: 74 6f 20 6d 61 6b 65 20 72 65 61 64 6f 6e 6c 79  to make readonly
1e70: 2c 20 74 68 69 73 20 77 69 6c 6c 20 62 65 20 6b  , this will be k
1e80: 6e 6f 77 6e 20 61 73 20 61 20 22 72 65 61 64 2d  nown as a "read-
1e90: 6f 6e 6c 79 20 74 61 67 22 20 2a 2f 0a 2b 20 20  only tag" */.+  
1ea0: 20 20 69 66 20 28 73 65 74 5f 72 65 61 64 4f 6e    if (set_readOn
1eb0: 6c 79 20 26 26 20 21 61 64 64 41 63 63 65 73 73  ly && !addAccess
1ec0: 44 65 6e 69 65 64 41 63 65 50 72 6f 63 28 6e 65  DeniedAceProc(ne
1ed0: 77 41 63 6c 2c 20 41 43 4c 5f 52 45 56 49 53 49  wAcl, ACL_REVISI
1ee0: 4f 4e 2c 20 0a 2b 20 20 20 20 20 20 72 65 61 64  ON, .+      read
1ef0: 4f 6e 6c 79 4d 61 73 6b 2c 20 75 73 65 72 53 69  OnlyMask, userSi
1f00: 64 29 29 0a 2b 20 20 20 20 20 20 20 20 67 6f 74  d)).+        got
1f10: 6f 20 64 6f 6e 65 3b 0a 2b 0a 2b 20 20 20 20 61  o done;.+.+    a
1f20: 63 6c 5f 72 65 61 64 4f 6e 6c 79 5f 66 6f 75 6e  cl_readOnly_foun
1f30: 64 20 3d 20 46 41 4c 53 45 3b 0a 2b 20 20 20 20  d = FALSE;.+    
1f40: 66 6f 72 20 28 6a 20 3d 20 30 3b 20 6a 20 3c 20  for (j = 0; j < 
1f50: 41 43 4c 53 69 7a 65 2e 41 63 65 43 6f 75 6e 74  ACLSize.AceCount
1f60: 3b 20 6a 2b 2b 29 20 7b 0a 2b 20 20 20 20 20 20  ; j++) {.+      
1f70: 20 20 50 41 43 4c 20 2a 70 41 43 45 32 3b 0a 2b    PACL *pACE2;.+
1f80: 20 20 20 20 20 20 20 20 41 43 45 5f 48 45 41 44          ACE_HEAD
1f90: 45 52 20 2a 70 68 41 43 45 32 3b 0a 2b 20 20 20  ER *phACE2;.+   
1fa0: 20 20 20 20 20 69 66 20 28 21 20 67 65 74 41 63       if (! getAc
1fb0: 65 50 72 6f 63 20 28 63 75 72 41 63 6c 2c 20 6a  eProc (curAcl, j
1fc0: 2c 20 28 4c 50 56 4f 49 44 2a 29 20 26 70 41 43  , (LPVOID*) &pAC
1fd0: 45 32 29 29 0a 2b 20 20 20 20 20 20 20 20 20 20  E2)).+          
1fe0: 20 20 67 6f 74 6f 20 64 6f 6e 65 3b 0a 2b 20 20    goto done;.+  
1ff0: 20 20 20 20 20 20 70 68 41 43 45 32 20 3d 20 28        phACE2 = (
2000: 28 41 43 45 5f 48 45 41 44 45 52 20 2a 29 20 70  (ACE_HEADER *) p
2010: 41 43 45 32 29 3b 0a 2b 0a 2b 20 20 20 20 20 20  ACE2);.+.+      
2020: 20 20 2f 2a 20 44 6f 20 4e 4f 54 20 70 72 6f 70    /* Do NOT prop
2030: 61 67 61 74 65 20 69 6e 68 65 72 69 74 65 64 20  agate inherited 
2040: 41 43 45 73 20 2a 2f 0a 2b 20 20 20 20 20 20 20  ACEs */.+       
2050: 20 69 66 20 28 70 68 41 43 45 32 2d 3e 41 63 65   if (phACE2->Ace
2060: 46 6c 61 67 73 20 26 20 49 4e 48 45 52 49 54 45  Flags & INHERITE
2070: 44 5f 41 43 45 29 0a 2b 20 20 20 20 20 20 20 20  D_ACE).+        
2080: 20 20 20 20 63 6f 6e 74 69 6e 75 65 3b 0a 2b 0a      continue;.+.
2090: 2b 20 20 20 20 20 20 20 20 2f 2a 20 53 6b 69 70  +        /* Skip
20a0: 20 74 68 65 20 22 72 65 61 64 2d 6f 6e 6c 79 20   the "read-only 
20b0: 74 61 67 22 20 72 65 73 74 72 69 63 74 69 6f 6e  tag" restriction
20c0: 20 28 65 69 74 68 65 72 20 61 64 64 65 64 20 61   (either added a
20d0: 62 6f 76 65 2c 20 6f 72 20 69 74 0a 2b 20 20 20  bove, or it.+   
20e0: 20 20 20 20 20 20 2a 20 69 73 20 62 65 69 6e 67        * is being
20f0: 20 72 65 6d 6f 76 65 64 29 20 0a 2b 20 20 20 20   removed) .+    
2100: 20 20 20 20 20 2a 2f 0a 2b 20 20 20 20 20 20 20       */.+       
2110: 20 69 66 20 28 70 68 41 43 45 32 2d 3e 41 63 65   if (phACE2->Ace
2120: 54 79 70 65 20 3d 3d 20 41 43 43 45 53 53 5f 44  Type == ACCESS_D
2130: 45 4e 49 45 44 5f 41 43 45 5f 54 59 50 45 29 20  ENIED_ACE_TYPE) 
2140: 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 41  {.+            A
2150: 43 43 45 53 53 5f 44 45 4e 49 45 44 5f 41 43 45  CCESS_DENIED_ACE
2160: 20 2a 70 41 43 45 64 20 3d 20 28 41 43 43 45 53   *pACEd = (ACCES
2170: 53 5f 44 45 4e 49 45 44 5f 41 43 45 20 2a 29 70  S_DENIED_ACE *)p
2180: 68 41 43 45 32 3b 0a 2b 20 20 20 20 20 20 20 20  hACE2;.+        
2190: 20 20 20 20 69 66 20 28 70 41 43 45 64 2d 3e 4d      if (pACEd->M
21a0: 61 73 6b 20 3d 3d 20 72 65 61 64 4f 6e 6c 79 4d  ask == readOnlyM
21b0: 61 73 6b 20 26 26 20 65 71 75 61 6c 53 69 64 50  ask && equalSidP
21c0: 72 6f 63 28 75 73 65 72 53 69 64 2c 20 0a 2b 20  roc(userSid, .+ 
21d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 50 53               (PS
21e0: 49 44 29 26 28 70 41 43 45 64 2d 3e 53 69 64 53  ID)&(pACEd->SidS
21f0: 74 61 72 74 29 29 29 20 7b 0a 2b 20 20 20 20 20  tart))) {.+     
2200: 20 20 20 20 20 20 20 20 20 20 20 61 63 6c 5f 72             acl_r
2210: 65 61 64 4f 6e 6c 79 5f 66 6f 75 6e 64 20 3d 20  eadOnly_found = 
2220: 54 52 55 45 3b 0a 2b 20 20 20 20 20 20 20 20 20  TRUE;.+         
2230: 20 20 20 20 20 20 20 63 6f 6e 74 69 6e 75 65 3b         continue;
2240: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a  .+            }.
2250: 2b 20 20 20 20 20 20 20 20 7d 0a 2b 0a 2b 20 20  +        }.+.+  
2260: 20 20 20 20 20 20 2f 2a 20 43 6f 70 79 20 74 68        /* Copy th
2270: 65 20 63 75 72 72 65 6e 74 20 41 43 45 20 66 72  e current ACE fr
2280: 6f 6d 20 74 68 65 20 6f 6c 64 20 74 6f 20 74 68  om the old to th
2290: 65 20 6e 65 77 20 41 43 4c 20 2a 2f 0a 2b 20 20  e new ACL */.+  
22a0: 20 20 20 20 20 20 69 66 28 21 20 61 64 64 41 63        if(! addAc
22b0: 65 50 72 6f 63 20 28 6e 65 77 41 63 6c 2c 20 41  eProc (newAcl, A
22c0: 43 4c 5f 52 45 56 49 53 49 4f 4e 2c 20 4d 41 58  CL_REVISION, MAX
22d0: 44 57 4f 52 44 2c 20 70 41 43 45 32 2c 20 0a 2b  DWORD, pACE2, .+
22e0: 20 20 20 20 20 20 20 20 20 20 28 28 50 41 43 45            ((PACE
22f0: 5f 48 45 41 44 45 52 29 20 70 41 43 45 32 29 2d  _HEADER) pACE2)-
2300: 3e 41 63 65 53 69 7a 65 29 29 0a 2b 20 20 20 20  >AceSize)).+    
2310: 20 20 20 20 20 20 20 20 67 6f 74 6f 20 64 6f 6e          goto don
2320: 65 3b 0a 2b 20 20 20 20 7d 0a 2b 0a 2b 20 20 20  e;.+    }.+.+   
2330: 20 2f 2a 20 41 70 70 6c 79 20 74 68 65 20 6e 65   /* Apply the ne
2340: 77 20 41 43 4c 20 2a 2f 0a 2b 20 20 20 20 69 66  w ACL */.+    if
2350: 20 28 73 65 74 5f 72 65 61 64 4f 6e 6c 79 20 3d   (set_readOnly =
2360: 3d 20 61 63 6c 5f 72 65 61 64 4f 6e 6c 79 5f 66  = acl_readOnly_f
2370: 6f 75 6e 64 0a 2b 20 20 20 20 20 20 20 20 7c 7c  ound.+        ||
2380: 20 73 65 74 4e 61 6d 65 64 53 65 63 75 72 69 74   setNamedSecurit
2390: 79 49 6e 66 6f 50 72 6f 63 28 28 4c 50 53 54 52  yInfoProc((LPSTR
23a0: 29 6e 61 74 69 76 65 50 61 74 68 2c 20 53 45 5f  )nativePath, SE_
23b0: 46 49 4c 45 5f 4f 42 4a 45 43 54 2c 20 0a 2b 20  FILE_OBJECT, .+ 
23c0: 20 20 20 20 20 20 20 20 20 20 20 20 44 41 43 4c              DACL
23d0: 5f 53 45 43 55 52 49 54 59 5f 49 4e 46 4f 52 4d  _SECURITY_INFORM
23e0: 41 54 49 4f 4e 2c 20 4e 55 4c 4c 2c 20 4e 55 4c  ATION, NULL, NUL
23f0: 4c 2c 20 6e 65 77 41 63 6c 2c 20 4e 55 4c 4c 29  L, newAcl, NULL)
2400: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 3d 3d 20  .+           == 
2410: 45 52 52 4f 52 5f 53 55 43 43 45 53 53 20 29 0a  ERROR_SUCCESS ).
2420: 2b 20 20 20 20 20 20 20 20 72 65 73 20 3d 20 30  +        res = 0
2430: 3b 0a 2b 20 20 20 0a 2b 20 64 6f 6e 65 3a 0a 2b  ;.+   .+ done:.+
2440: 20 20 20 20 69 66 20 28 73 65 63 44 65 73 63 29      if (secDesc)
2450: 0a 2b 20 20 20 20 20 20 20 20 63 6b 66 72 65 65  .+        ckfree
2460: 28 73 65 63 44 65 73 63 29 3b 0a 2b 20 20 20 20  (secDesc);.+    
2470: 69 66 20 28 6e 65 77 41 63 6c 29 0a 2b 20 20 20  if (newAcl).+   
2480: 20 20 20 20 20 63 6b 66 72 65 65 28 28 63 68 61       ckfree((cha
2490: 72 20 2a 29 6e 65 77 41 63 6c 29 3b 0a 2b 20 20  r *)newAcl);.+  
24a0: 20 20 69 66 20 28 75 73 65 72 53 69 64 29 0a 2b    if (userSid).+
24b0: 20 20 20 20 20 20 20 20 63 6b 66 72 65 65 28 28          ckfree((
24c0: 63 68 61 72 20 2a 29 75 73 65 72 53 69 64 29 3b  char *)userSid);
24d0: 0a 2b 20 20 20 20 69 66 20 28 75 73 65 72 44 6f  .+    if (userDo
24e0: 6d 61 69 6e 29 0a 2b 20 20 20 20 20 20 20 20 63  main).+        c
24f0: 6b 66 72 65 65 28 75 73 65 72 44 6f 6d 61 69 6e  kfree(userDomain
2500: 29 3b 0a 2b 0a 2b 20 20 20 20 69 66 20 28 72 65  );.+.+    if (re
2510: 73 20 21 3d 20 30 29 0a 2b 20 20 20 20 20 20 20  s != 0).+       
2520: 20 72 65 74 75 72 6e 20 72 65 73 3b 0a 2b 23 65   return res;.+#e
2530: 6e 64 69 66 0a 2b 0a 2b 20 20 20 20 2f 2a 20 52  ndif.+.+    /* R
2540: 75 6e 20 6e 6f 72 6d 61 6c 20 63 68 6d 6f 64 20  un normal chmod 
2550: 63 6f 6d 6d 61 6e 64 20 2a 2f 0a 2b 20 20 20 20  command */.+    
2560: 72 65 74 75 72 6e 20 63 68 6d 6f 64 28 6e 61 74  return chmod(nat
2570: 69 76 65 50 61 74 68 2c 20 70 6d 6f 64 65 29 3b  ivePath, pmode);
2580: 0a 2b 7d 0a 2b 0a 20 73 74 61 74 69 63 20 69 6e  .+}.+. static in
2590: 74 0a 20 54 65 73 74 63 68 6d 6f 64 43 6d 64 28  t. TestchmodCmd(
25a0: 64 75 6d 6d 79 2c 20 69 6e 74 65 72 70 2c 20 61  dummy, interp, a
25b0: 72 67 63 2c 20 61 72 67 76 29 0a 20 20 20 20 20  rgc, argv).     
25c0: 43 6c 69 65 6e 74 44 61 74 61 20 64 75 6d 6d 79  ClientData dummy
25d0: 3b 09 09 09 2f 2a 20 4e 6f 74 20 75 73 65 64 2e  ;.../* Not used.
25e0: 20 2a 2f 0a 40 40 20 2d 34 30 34 38 2c 37 20 2b   */.@@ -4048,7 +
25f0: 34 32 39 37 2c 37 20 40 40 0a 20 20 20 20 20 20  4297,7 @@.      
2600: 20 20 20 69 66 20 28 74 72 61 6e 73 6c 61 74 65     if (translate
2610: 64 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 20 20 20  d == NULL) {.   
2620: 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e            return
2630: 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 20 20 20 20   TCL_ERROR;.    
2640: 20 20 20 20 20 7d 0a 2d 09 69 66 20 28 63 68 6d       }.-.if (chm
2650: 6f 64 28 74 72 61 6e 73 6c 61 74 65 64 2c 20 28  od(translated, (
2660: 75 6e 73 69 67 6e 65 64 29 20 6d 6f 64 65 29 20  unsigned) mode) 
2670: 21 3d 20 30 29 20 7b 0a 2b 09 69 66 20 28 54 65  != 0) {.+.if (Te
2680: 73 74 70 6c 61 66 74 6f 72 6d 5f 63 68 6d 6f 64  stplaftorm_chmod
2690: 28 74 72 61 6e 73 6c 61 74 65 64 2c 20 28 75 6e  (translated, (un
26a0: 73 69 67 6e 65 64 29 20 6d 6f 64 65 29 20 21 3d  signed) mode) !=
26b0: 20 30 29 20 7b 0a 20 09 20 20 20 20 54 63 6c 5f   0) {. .    Tcl_
26c0: 41 70 70 65 6e 64 52 65 73 75 6c 74 28 69 6e 74  AppendResult(int
26d0: 65 72 70 2c 20 74 72 61 6e 73 6c 61 74 65 64 2c  erp, translated,
26e0: 20 22 3a 20 22 2c 20 54 63 6c 5f 50 6f 73 69 78   ": ", Tcl_Posix
26f0: 45 72 72 6f 72 28 69 6e 74 65 72 70 29 2c 0a 20  Error(interp),. 
2700: 09 09 20 20 20 20 28 63 68 61 72 20 2a 29 20 4e  ..    (char *) N
2710: 55 4c 4c 29 3b 0a 20 09 20 20 20 20 72 65 74 75  ULL);. .    retu
2720: 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a        rn TCL_ERROR;.