Windows: remember when a reparse point is opened
authorPeter Scott <pscott@kerneldrivers.com>
Wed, 2 Nov 2011 23:25:36 +0000 (19:25 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 3 Nov 2011 04:21:24 +0000 (21:21 -0700)
If the mount point or symlink is opened as a reparse point
we must remember that in the Ccb so that later reparse point
processing can be implemented properly.  For now remember
with the CCB_FLAG_MASK_OPENED_REPARSE_POINT flag.

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

src/WINNT/afsrdr/kernel/lib/AFSCreate.cpp
src/WINNT/afsrdr/kernel/lib/Include/AFSDefines.h

index bc1358f..a9b9ac9 100644 (file)
@@ -145,6 +145,7 @@ AFSCommonCreate( IN PDEVICE_OBJECT DeviceObject,
     ULONG               ulParseFlags = 0;
     GUID                stAuthGroup;
     ULONG               ulNameProcessingFlags = 0;
+    BOOLEAN             bOpenedReparsePoint = FALSE;
 
     __Enter
     {
@@ -648,16 +649,22 @@ AFSCommonCreate( IN PDEVICE_OBJECT DeviceObject,
         }
 
         if ( BooleanFlagOn( ulOptions, FILE_OPEN_REPARSE_POINT) &&
-             pDirectoryCB != NULL &&
-             !BooleanFlagOn( pDirectoryCB->ObjectInformation->FileAttributes, FILE_ATTRIBUTE_REPARSE_POINT))
+             pDirectoryCB != NULL)
         {
 
-            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSCommonCreate (%08lX) Reparse open request but attribute not set for %wZ Type %08lX\n",
-                          Irp,
-                          &uniFileName,
-                          pDirectoryCB->ObjectInformation->FileType);
+            if( !BooleanFlagOn( pDirectoryCB->ObjectInformation->FileAttributes, FILE_ATTRIBUTE_REPARSE_POINT))
+            {
+                AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                              AFS_TRACE_LEVEL_VERBOSE,
+                              "AFSCommonCreate (%08lX) Reparse open request but attribute not set for %wZ Type %08lX\n",
+                              Irp,
+                              &uniFileName,
+                              pDirectoryCB->ObjectInformation->FileType);
+            }
+            else
+            {
+                bOpenedReparsePoint = TRUE;
+            }
         }
 
         //
@@ -1052,6 +1059,11 @@ try_exit:
                     }
                 }
 
+                if( bOpenedReparsePoint)
+                {
+                    SetFlag( pCcb->Flags, CCB_FLAG_MASK_OPENED_REPARSE_POINT);
+                }
+
                 AFSDbgLogMsg( AFS_SUBSYSTEM_DIRENTRY_REF_COUNTING,
                               AFS_TRACE_LEVEL_VERBOSE,
                               "AFSCreate Count on %wZ DE %p Ccb %p Cnt %d\n",
index 8107ea7..8f070c1 100644 (file)
@@ -226,6 +226,7 @@ NTSTATUS
 #define CCB_FLAG_RETURN_RELATIVE_ENTRIES    0x00000010
 #define CCB_FLAGS_DIRECTORY_QUERY_MAPPED    0x00000020
 #define CCB_FLAG_MASK_PIOCTL_QUERY          0x00000040
+#define CCB_FLAG_MASK_OPENED_REPARSE_POINT  0x00000080
 
 //
 // DirEntry flags