From e24ed842eba54f62105b08d2b9fb281cc19519f1 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 12 Mar 2014 12:49:40 -0400 Subject: [PATCH] Windows: NP Fail requests if AFSGetAuthenticationId fails 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 Tested-by: Jeffrey Altman --- .../kernel/lib/AFSNetworkProviderSupport.cpp | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/WINNT/afsrdr/kernel/lib/AFSNetworkProviderSupport.cpp b/src/WINNT/afsrdr/kernel/lib/AFSNetworkProviderSupport.cpp index f3b63c89d..559545e20 100644 --- a/src/WINNT/afsrdr/kernel/lib/AFSNetworkProviderSupport.cpp +++ b/src/WINNT/afsrdr/kernel/lib/AFSNetworkProviderSupport.cpp @@ -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", -- 2.39.5