Windows: NP AFSGetConnection retrieve AuthId sooner
[openafs.git] / src / WINNT / afsrdr / kernel / lib / AFSNetworkProviderSupport.cpp
index c6cd352..51eab1e 100644 (file)
@@ -121,6 +121,8 @@ AFSAddConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
                               &uniRemoteName,
                               ConnectCB->LocalName,
                               ConnectCB->AuthenticationId.QuadPart));
+
+                *ResultStatus = WN_ALREADY_CONNECTED;
             }
             else
             {
@@ -130,13 +132,13 @@ AFSAddConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
                               "AFSAddConnection ALREADY_CONNECTED remote name %wZ Local (NULL) authentication id %I64X\n",
                               &uniRemoteName,
                               ConnectCB->AuthenticationId.QuadPart));
-            }
 
-            *ResultStatus = WN_ALREADY_CONNECTED;
+                *ResultStatus = WN_SUCCESS;
+            }
 
             *ReturnOutputBufferLength = sizeof( ULONG);
 
-            try_return( ntStatus);
+            try_return( ntStatus = STATUS_SUCCESS);
         }
 
         //
@@ -546,6 +548,17 @@ AFSGetConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
     __Enter
     {
 
+       if( ConnectCB->AuthenticationId.QuadPart == 0)
+       {
+
+           ConnectCB->AuthenticationId = AFSGetAuthenticationId();
+
+           AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                         AFS_TRACE_LEVEL_VERBOSE,
+                         "AFSGetConnection Retrieved authentication id %I64X\n",
+                         ConnectCB->AuthenticationId.QuadPart));
+       }
+
         if( ConnectCB->LocalName != L'\0')
         {
 
@@ -570,17 +583,6 @@ AFSGetConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
                       &pRDRDevExt->Specific.RDR.ProviderListLock,
                       PsGetCurrentThread()));
 
-        if( ConnectCB->AuthenticationId.QuadPart == 0)
-        {
-
-            ConnectCB->AuthenticationId = AFSGetAuthenticationId();
-
-            AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
-                          AFS_TRACE_LEVEL_VERBOSE,
-                          "AFSGetConnection Retrieved authentication id %I64X\n",
-                          ConnectCB->AuthenticationId.QuadPart));
-        }
-
         AFSAcquireShared( &pRDRDevExt->Specific.RDR.ProviderListLock,
                           TRUE);
 
@@ -765,10 +767,7 @@ AFSListConnections( IN OUT AFSNetworkProviderConnectionCB *ConnectCB,
             // adjust it to be the server name itself
             //
 
-            if( uniShareName.Length == 0 ||
-                RtlCompareUnicodeString( &uniShareName,
-                                         &AFSGlobalRootName,
-                                         TRUE) == 0)
+            if( uniShareName.Length == 0)
             {
 
                 bGlobalEnumeration = TRUE;