Windows: NP Fail requests if AFSGetAuthenticationId fails
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 12 Mar 2014 16:49:40 +0000 (12:49 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Thu, 17 Apr 2014 12:49:18 +0000 (05:49 -0700)
If during the processing of a network provider request the Logon
Session AuthenticationId is zero and the AFSGetAuthenticationId()
function is unable to obtain the current thread's AuthenticationId,
then fail the request.

Reviewed-on: http://gerrit.openafs.org/10900
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit e24ed842eba54f62105b08d2b9fb281cc19519f1)

Change-Id: I4a3b80062fc7efc9fa018f1bfe09910629fad14e
Reviewed-on: http://gerrit.openafs.org/11082
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

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

index f3b63c8..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",
@@ -1471,6 +1511,16 @@ AFSGetConnectionInfo( IN AFSNetworkProviderConnectionCB *ConnectCB,
 
            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",