Windows: AFSParseName edge cases
authorJeffrey Altman <jaltman@your-file-system.com>
Sat, 14 Jan 2012 04:57:10 +0000 (23:57 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 18 Jan 2012 15:34:56 +0000 (07:34 -0800)
If the input path is \afs\ behave as if the path is \afs.

If the input path is \afs\*\ detect the wildcard and return
STATUS_OBJECT_NAME_INVALID.

Change-Id: I0ef4f30fb3b6245a52160b5e7f9233bc5f599485
Reviewed-on: http://gerrit.openafs.org/6553
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSNameSupport.cpp

index 2adf59e..1c8b261 100644 (file)
@@ -3097,6 +3097,18 @@ AFSParseName( IN PIRP Irp,
             }
         }
 
+        if( FsRtlDoesNameContainWildCards( &uniFullName))
+        {
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_ERROR,
+                          "AFSParseName (%08lX) Component %wZ contains wild cards\n",
+                          Irp,
+                          &uniFullName);
+
+            try_return( ntStatus = STATUS_OBJECT_NAME_INVALID);
+        }
+
         AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
                       AFS_TRACE_LEVEL_VERBOSE_2,
                       "AFSParseName (%08lX) Processing full name %wZ\n",
@@ -3246,11 +3258,24 @@ AFSParseName( IN PIRP Irp,
                           &uniComponentName,
                           &uniRemainingPath);
 
+        if( FsRtlDoesNameContainWildCards( &uniFullName))
+        {
+
+            AFSDbgLogMsg( AFS_SUBSYSTEM_FILE_PROCESSING,
+                          AFS_TRACE_LEVEL_ERROR,
+                          "AFSParseName (%08lX) Component %wZ contains wild cards\n",
+                          Irp,
+                          &uniComponentName);
+
+            try_return( ntStatus = STATUS_OBJECT_NAME_INVALID);
+        }
+
         //
         // If this is the ALL access then perform some additional processing
         //
 
-        if( RtlCompareUnicodeString( &uniComponentName,
+        if( uniComponentName.Length == 0 ||
+            RtlCompareUnicodeString( &uniComponentName,
                                      &AFSGlobalRootName,
                                      TRUE) == 0)
         {