windows-scache-verification-20080307
authorJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 7 Mar 2008 17:44:40 +0000 (17:44 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 7 Mar 2008 17:44:40 +0000 (17:44 +0000)
LICENSE MIT

Add a hash value verification check for stat cache entries

src/WINNT/afsd/cm_scache.c

index e688ea2..edd0733 100644 (file)
@@ -461,6 +461,8 @@ cm_ValidateSCache(void)
 
     for ( i=0; i < cm_data.scacheHashTableSize; i++ ) {
         for ( scp = cm_data.scacheHashTablep[i]; scp; scp = scp->nextp ) {
+            afs_uint32 hash;
+            hash = CM_SCACHE_HASH(&scp->fid);
             if (scp->magic != CM_SCACHE_MAGIC) {
                 afsi_log("cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC");
                 fprintf(stderr, "cm_ValidateSCache failure: scp->magic != CM_SCACHE_MAGIC\n");
@@ -481,6 +483,11 @@ cm_ValidateSCache(void)
                 fprintf(stderr, "cm_ValidateSCache failure: scp->volp->magic != CM_VOLUME_MAGIC\n");
                 return -12;
             }
+            if (hash != i) {
+                afsi_log("cm_ValidateSCache failure: scp hash != hash index");
+                fprintf(stderr, "cm_ValidateSCache failure: scp hash != hash index\n");
+                return -13;
+            }
         }
     }