hidden-dot-files-20040807
authorAsanka Herath <asanka@mit.edu>
Sat, 7 Aug 2004 17:56:26 +0000 (17:56 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 7 Aug 2004 17:56:26 +0000 (17:56 +0000)
Hide dot files even when we can't stat the file.

src/WINNT/afsd/smb.c
src/WINNT/afsd/smb3.c

index 5fb9e5b..9dd6f56 100644 (file)
@@ -3185,17 +3185,25 @@ long smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp,
 
        for(patchp = *dirPatchespp; patchp; patchp =
                 (smb_dirListPatch_t *) osi_QNext(&patchp->q)) {
-               code = cm_GetSCache(&patchp->fid, &scp, userp, reqp);
-               if (code) continue;
+
+        dptr = patchp->dptr;
+
+        code = cm_GetSCache(&patchp->fid, &scp, userp, reqp);
+        if (code) {
+            if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE )
+                *dptr++ = SMB_ATTR_HIDDEN;
+            continue;
+        }
                lock_ObtainMutex(&scp->mx);
                code = cm_SyncOp(scp, NULL, userp, reqp, 0,
                                                  CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
                if (code) {     
                        lock_ReleaseMutex(&scp->mx);
                        cm_ReleaseSCache(scp);
+            if( patchp->flags & SMB_DIRLISTPATCH_DOTFILE )
+                *dptr++ = SMB_ATTR_HIDDEN;
                        continue;
                }
-               dptr = patchp->dptr;
 
                attr = smb_Attributes(scp);
         /* check hidden attribute (the flag is only ON when dot file hiding is on ) */
@@ -3203,7 +3211,7 @@ long smb_ApplyDirListPatches(smb_dirListPatch_t **dirPatchespp,
             attr |= SMB_ATTR_HIDDEN;
         *dptr++ = attr;
 
-               /* get dos time */
+        /* get dos time */
                smb_SearchTimeFromUnixTime(&dosTime, scp->clientModTime);
                 
                /* copy out time */
index 31450bc..e9468b0 100644 (file)
@@ -3016,6 +3016,13 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp,
 
                            /* copy to Change Time */
                            *((FILETIME *)dptr) = ft;
+                dptr += 24;
+
+                /* merge in hidden attribute */
+                if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) {
+                               *((u_long *)dptr) = SMB_ATTR_HIDDEN;
+                }
+                           dptr += 4;
 
             } else {
                 /* 1969-12-31 23:59:58 +00*/
@@ -3049,7 +3056,15 @@ long smb_ApplyV3DirListPatches(cm_scache_t *dscp,
                            /* copy out mod time */
                            shortTemp = dosTime & 0xffff;
                            *((u_short *)dptr) = shortTemp;
-                           dptr += 2;
+                           dptr += 10;
+
+                /* merge in hidden (dot file) attribute */
+                if ( patchp->flags & SMB_DIRLISTPATCH_DOTFILE ) {
+                    attr == SMB_ATTR_HIDDEN;
+                               *dptr++ = attr & 0xff;
+                               *dptr++ = (attr >> 8) & 0xff;
+                }
+
             }
                        continue;
         }