]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
windows-scp-recycle-init-20070208
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 8 Feb 2007 13:49:58 +0000 (13:49 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 8 Feb 2007 13:49:58 +0000 (13:49 +0000)
when we recycle a stat cache object be sure to clear the file type so
we don't inherit the previous file type if the fetch status fails.

in merge status, clear the file type if the errorCode is EACCESS

src/WINNT/afsd/cm_access.c
src/WINNT/afsd/cm_scache.c

index d9d141a9af18330baa104c440a88a7fe3725dafb..4b1f71926e1c4307fb84de349e90198f07d74477 100644 (file)
@@ -40,8 +40,8 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
     long trights;
 
     if (scp->flags & CM_SCACHEFLAG_EACCESS) {
-       *outRightsp = aclScp->anyAccess;
-       return CM_ERROR_NOACCESS;
+       *outRightsp = 0;
+       return 1;
     }
 
     didLock = 0;
@@ -64,7 +64,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
                 return 0;
             }
 
-            /* check that we have a callback, too */
+           /* check that we have a callback, too */
             if (!cm_HaveCallback(aclScp)) {
                 /* can't use it */
                 lock_ReleaseMutex(&aclScp->mx);
@@ -99,7 +99,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32
         *outRightsp = trights;
     }
 
-    if (scp->fileType != CM_SCACHETYPE_DIRECTORY) {
+    if (scp->fileType > 0 && scp->fileType != CM_SCACHETYPE_DIRECTORY) {
        /* check mode bits */
        if ((scp->unixModeBits & 0400) == 0) {
            osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing READ scp 0x%p unix 0x%x", 
index 9431712be24e94d996f364bd4371898383eaa570..b8a30e9a0118fc9ce2629f7b251d8479227cd5d0 100644 (file)
@@ -147,6 +147,7 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags)
 
     /* invalidate so next merge works fine;
      * also initialize some flags */
+    scp->fileType = 0;
     scp->flags &= ~(CM_SCACHEFLAG_STATD
                     | CM_SCACHEFLAG_DELETED
                     | CM_SCACHEFLAG_RO
@@ -577,7 +578,7 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp,
             return 0;
         }
     }
-        
+
     // yj: when we get here, it means we don't have an scp
     // so we need to either load it or fake it, depending
     // on whether the file is "special", see below.
@@ -1316,6 +1317,8 @@ void cm_MergeStatus(cm_scache_t *dscp,
        scp->flags |= CM_SCACHEFLAG_EACCESS;
        osi_Log2(afsd_logp, "Merge, Failure scp %x code 0x%x", scp, statusp->errorCode);
 
+       scp->fileType = 0;      /* unknown */
+
        scp->serverModTime = 0;
        scp->clientModTime = 0;
        scp->length.LowPart = 0;