Windows: NP Fail requests if AFSGetAuthenticationId fails
[openafs.git] / src / WINNT / afsrdr / kernel / lib / AFSNetworkProviderSupport.cpp
index 51eab1e..559545e 100644 (file)
@@ -63,6 +63,16 @@ AFSAddConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
 
             ConnectCB->AuthenticationId = AFSGetAuthenticationId();
 
+           if ( ConnectCB->AuthenticationId.QuadPart == 0)
+           {
+
+               AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                             AFS_TRACE_LEVEL_ERROR,
+                             "AFSAddConnection Unable to retrieve authentication id\n"));
+
+               return STATUS_ACCESS_DENIED;
+           }
+
             AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
                           AFS_TRACE_LEVEL_VERBOSE,
                           "AFSAddConnection Retrieved authentication id %I64X\n",
@@ -428,6 +438,16 @@ AFSCancelConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
 
             ConnectCB->AuthenticationId = AFSGetAuthenticationId();
 
+           if ( ConnectCB->AuthenticationId.QuadPart == 0)
+           {
+
+               AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                             AFS_TRACE_LEVEL_ERROR,
+                             "AFSCancelConnection Unable to retrieve authentication id\n"));
+
+               return STATUS_ACCESS_DENIED;
+           }
+
             AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
                           AFS_TRACE_LEVEL_VERBOSE,
                           "AFSCancelConnection Retrieved authentication id %I64X\n",
@@ -553,6 +573,16 @@ AFSGetConnection( IN AFSNetworkProviderConnectionCB *ConnectCB,
 
            ConnectCB->AuthenticationId = AFSGetAuthenticationId();
 
+           if ( ConnectCB->AuthenticationId.QuadPart == 0)
+           {
+
+               AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                             AFS_TRACE_LEVEL_ERROR,
+                             "AFSGetConnection Unable to retrieve authentication id\n"));
+
+               return STATUS_ACCESS_DENIED;
+           }
+
            AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
                          AFS_TRACE_LEVEL_VERBOSE,
                          "AFSGetConnection Retrieved authentication id %I64X\n",
@@ -693,6 +723,16 @@ AFSListConnections( IN OUT AFSNetworkProviderConnectionCB *ConnectCB,
 
             ConnectCB->AuthenticationId = AFSGetAuthenticationId();
 
+           if ( ConnectCB->AuthenticationId.QuadPart == 0)
+           {
+
+               AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                             AFS_TRACE_LEVEL_ERROR,
+                             "AFSListConnections Unable to retrieve authentication id\n"));
+
+               return STATUS_ACCESS_DENIED;
+           }
+
             AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
                           AFS_TRACE_LEVEL_VERBOSE,
                           "AFSListConnections Retrieved authentication id %I64X\n",
@@ -1466,6 +1506,27 @@ AFSGetConnectionInfo( IN AFSNetworkProviderConnectionCB *ConnectCB,
         uniRemoteName.MaximumLength = uniRemoteName.Length + sizeof( WCHAR);
         uniRemoteName.Buffer = (WCHAR *)ConnectCB->RemoteName;
 
+       if( ConnectCB->AuthenticationId.QuadPart == 0)
+       {
+
+           ConnectCB->AuthenticationId = AFSGetAuthenticationId();
+
+           if ( ConnectCB->AuthenticationId.QuadPart == 0)
+           {
+
+               AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                             AFS_TRACE_LEVEL_ERROR,
+                             "AFSGetConnectionInfo Unable to retrieve authentication id\n"));
+
+               return STATUS_ACCESS_DENIED;
+           }
+
+           AFSDbgTrace(( AFS_SUBSYSTEM_NETWORK_PROVIDER,
+                         AFS_TRACE_LEVEL_VERBOSE,
+                         "AFSGetConnectionInfo Retrieved authentication id %I64X\n",
+                         ConnectCB->AuthenticationId.QuadPart));
+       }
+
         if( ConnectCB->LocalName != L'\0')
         {