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>
Wed, 16 Apr 2014 13:08:57 +0000 (06:08 -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.

Change-Id: If2aeba836d762f4f1b982d954fac720863a05c1f
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>

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",