Windows: no drive subst for NPCancelConnection
authorJeffrey Altman <jaltman@your-file-system.com>
Tue, 29 Nov 2011 19:55:55 +0000 (14:55 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 29 Nov 2011 23:35:39 +0000 (15:35 -0800)
NPCancelConnection() must use the results of a Get Connection
ioctl to the afs redirector and not the result of Drive Letter
Substitution queries via DosQueryDevice().  Rename NPGetConnection()
to NPGetConnectionCommon() and add a new parameter to indicate
whether drive substitution is ok.

Change-Id: I42cd4488038f128ae90356a41bc538966d9cebed
Reviewed-on: http://gerrit.openafs.org/6139
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/npdll/AFS_Npdll.c

index e63ee09..51fe57a 100644 (file)
 
 ULONG _cdecl AFSDbgPrint( PWCHAR Format, ... );
 
+static DWORD APIENTRY
+NPGetConnectionCommon( LPWSTR  lpLocalName,
+                       LPWSTR  lpRemoteName,
+                       LPDWORD lpBufferSize,
+                       BOOL    bDriveSubstOk);
+
 #define WNNC_DRIVER( major, minor ) ( major * 0x00010000 + minor )
 
 #define OPENAFS_PROVIDER_NAME           L"OpenAFS Network"
@@ -912,9 +918,10 @@ NPCancelConnection( LPWSTR  lpName,
             // Get the remote name for the connection, if we are handling it
             //
 
-            dwStatus = NPGetConnection( lpName,
-                                        wchRemoteName,
-                                        &dwRemoteNameLength);
+            dwStatus = NPGetConnectionCommon( wchLocalName,
+                                              wchRemoteName,
+                                              &dwRemoteNameLength,
+                                              FALSE);
 
             if( dwStatus != WN_SUCCESS ||
                 dwRemoteNameLength == 0)
@@ -1155,6 +1162,20 @@ NPGetConnection( LPWSTR  lpLocalName,
                  LPDWORD lpBufferSize)
 {
 
+    return NPGetConnectionCommon( lpLocalName,
+                                  lpRemoteName,
+                                  lpBufferSize,
+                                  TRUE);
+}
+
+DWORD
+APIENTRY
+NPGetConnectionCommon( LPWSTR  lpLocalName,
+                       LPWSTR  lpRemoteName,
+                       LPDWORD lpBufferSize,
+                       BOOL    bDriveSubstOk)
+{
+
     DWORD    dwStatus = WN_NOT_CONNECTED;
     WCHAR    wchLocalName[3];
     WCHAR    wchSubstName[MAX_PATH + 1];
@@ -1195,7 +1216,8 @@ NPGetConnection( LPWSTR  lpLocalName,
 
         dwPassedSize = *lpBufferSize;
 
-        if ( !DriveSubstitution( lpLocalName, wchSubstName, sizeof( wchSubstName)))
+        if ( !bDriveSubstOk ||
+             !DriveSubstitution( lpLocalName, wchSubstName, sizeof( wchSubstName)))
         {
             wchLocalName[0] = towupper(lpLocalName[0]);
             wchLocalName[1] = L':';