Windows: Handle invalid node types
authorPeter Scott <pscott@kerneldrivers.com>
Fri, 30 Dec 2011 00:30:45 +0000 (17:30 -0700)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Dec 2011 21:44:44 +0000 (13:44 -0800)
In the case where the direntry data is invalid, construct an Fcb
of type INVALID so that the direntry can be displayed and the objected
deleted even if it cannot be evaluated.

Change-Id: I37da154b7429929fe833874c7cd048a3a804a96f
Reviewed-on: http://gerrit.openafs.org/6445
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSCleanup.cpp
src/WINNT/afsrdr/kernel/lib/AFSClose.cpp
src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/AFSFcbSupport.cpp
src/WINNT/afsrdr/kernel/lib/AFSFileInfo.cpp
src/WINNT/afsrdr/kernel/lib/AFSLockControl.cpp
src/WINNT/afsrdr/kernel/lib/AFSVolumeInfo.cpp

index e51ca8c..69096ec 100644 (file)
@@ -883,6 +883,7 @@ AFSCleanup( IN PDEVICE_OBJECT LibDeviceObject,
             case AFS_SYMBOLIC_LINK_FCB:
             case AFS_MOUNT_POINT_FCB:
             case AFS_DFS_LINK_FCB:
+            case AFS_INVALID_FCB:
             {
 
                 //
index a757bb2..938288f 100644 (file)
@@ -285,6 +285,7 @@ AFSClose( IN PDEVICE_OBJECT LibDeviceObject,
             case AFS_SYMBOLIC_LINK_FCB:
             case AFS_MOUNT_POINT_FCB:
             case AFS_DFS_LINK_FCB:
+            case AFS_INVALID_FCB:
             {
 
                 pCcb = (AFSCcb *)pIrpSp->FileObject->FsContext2;
index 1b9c5f7..7c3c2d4 100644 (file)
@@ -1977,7 +1977,8 @@ AFSProcessCreate( IN PIRP               Irp,
         }
         else if( (*Fcb)->Header.NodeTypeCode == AFS_MOUNT_POINT_FCB ||
                  (*Fcb)->Header.NodeTypeCode == AFS_SYMBOLIC_LINK_FCB ||
-                 (*Fcb)->Header.NodeTypeCode == AFS_DFS_LINK_FCB)
+                 (*Fcb)->Header.NodeTypeCode == AFS_DFS_LINK_FCB ||
+                 (*Fcb)->Header.NodeTypeCode == AFS_INVALID_FCB)
         {
 
             //
@@ -2690,7 +2691,8 @@ AFSProcessOpen( IN PIRP Irp,
         }
         else if( pObjectInfo->Fcb->Header.NodeTypeCode == AFS_MOUNT_POINT_FCB ||
                  pObjectInfo->Fcb->Header.NodeTypeCode == AFS_SYMBOLIC_LINK_FCB ||
-                 pObjectInfo->Fcb->Header.NodeTypeCode == AFS_DFS_LINK_FCB)
+                 pObjectInfo->Fcb->Header.NodeTypeCode == AFS_DFS_LINK_FCB ||
+                 pObjectInfo->Fcb->Header.NodeTypeCode == AFS_INVALID_FCB)
         {
 
         }
index bfdbbe8..8fdc8b6 100644 (file)
@@ -276,8 +276,7 @@ AFSInitFcb( IN AFSDirectoryCB  *DirEntry,
         }
         else
         {
-            ASSERT( FALSE);
-            try_return( ntStatus = STATUS_INVALID_PARAMETER);
+            pFcb->Header.NodeTypeCode = AFS_INVALID_FCB;
         }
 
         //
index 98811ac..36fe3ac 100644 (file)
@@ -139,6 +139,15 @@ AFSQueryFileInfo( IN PDEVICE_OBJECT LibDeviceObject,
             try_return( ntStatus);
         }
 
+        else if( pFcb->Header.NodeTypeCode == AFS_INVALID_FCB)
+        {
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSQueryFileInfo request against Invalid Fcb\n");
+
+            try_return( ntStatus = STATUS_ACCESS_DENIED);
+        }
+
         //
         // Process the request
         //
@@ -559,6 +568,16 @@ AFSSetFileInfo( IN PDEVICE_OBJECT LibDeviceObject,
             try_return( ntStatus = STATUS_ACCESS_DENIED);
         }
 
+        if( pFcb->Header.NodeTypeCode == AFS_INVALID_FCB &&
+            FileInformationClass != FileDispositionInformation)
+        {
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_VERBOSE,
+                          "AFSSetFileInfo request against Invalid Fcb\n");
+
+            try_return( ntStatus = STATUS_ACCESS_DENIED);
+        }
+
         //
         // Ensure rename operations are synchronous
         //
@@ -1976,7 +1995,7 @@ AFSSetDispositionInfo( IN PIRP Irp,
                     try_return( ntStatus = STATUS_DIRECTORY_NOT_EMPTY);
                 }
             }
-            else
+            else if( pFcb->Header.NodeTypeCode == AFS_FILE_FCB)
             {
 
                 //
index c6e6b7d..0d14d81 100644 (file)
@@ -108,6 +108,15 @@ AFSLockControl( IN PDEVICE_OBJECT LibDeviceObject,
 
             try_return( ntStatus = STATUS_INVALID_DEVICE_REQUEST);
         }
+        else if( pFcb->Header.NodeTypeCode == AFS_INVALID_FCB)
+        {
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_ERROR,
+                          "AFSLockControl Failing request against Invalid Fcb\n");
+
+            try_return( ntStatus = STATUS_INVALID_DEVICE_REQUEST);
+        }
 
         //
         // Post the request to the service for checks
index c481e38..72c1e4c 100644 (file)
@@ -106,6 +106,15 @@ AFSQueryVolumeInfo( IN PDEVICE_OBJECT LibDeviceObject,
 
             try_return( ntStatus = STATUS_INVALID_DEVICE_REQUEST);
         }
+        else if( pFcb->Header.NodeTypeCode == AFS_INVALID_FCB)
+        {
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_ERROR,
+                          "AFSQueryVolumeInfo Failing request against SpecialShare Fcb\n");
+
+            try_return( ntStatus = STATUS_INVALID_DEVICE_REQUEST);
+        }
 
         //
         // Process the request