From 21a3647f09ca92cbf890129d4e917cbd01a1b374 Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Mon, 5 Dec 2022 13:44:53 -0800 Subject: [PATCH] add SEC_E_CONTEXT_EXPIRED to avoid throwing InternalException (#79129) --- .../src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs | 1 + .../Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs | 3 ++- src/libraries/Common/src/System/Net/SecurityStatusPal.cs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libraries/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs b/src/libraries/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs index 17fe421cb5aff1..67370f9587fa08 100644 --- a/src/libraries/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs +++ b/src/libraries/Common/src/Interop/Windows/SChannel/Interop.SECURITY_STATUS.cs @@ -33,6 +33,7 @@ internal enum SECURITY_STATUS MessageAltered = unchecked((int)0x8009030F), OutOfSequence = unchecked((int)0x80090310), NoAuthenticatingAuthority = unchecked((int)0x80090311), + ContextExpiredError = unchecked((int)0x80090317), IncompleteMessage = unchecked((int)0x80090318), IncompleteCredentials = unchecked((int)0x80090320), BufferNotEnough = unchecked((int)0x80090321), diff --git a/src/libraries/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs b/src/libraries/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs index f804caddbd01c6..a6b4e4115d48f4 100644 --- a/src/libraries/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs +++ b/src/libraries/Common/src/System/Net/SecurityStatusAdapterPal.Windows.cs @@ -9,7 +9,7 @@ namespace System.Net { internal static class SecurityStatusAdapterPal { - private const int StatusDictionarySize = 44; + private const int StatusDictionarySize = 45; #if DEBUG static SecurityStatusAdapterPal() @@ -31,6 +31,7 @@ static SecurityStatusAdapterPal() { Interop.SECURITY_STATUS.CompAndContinue, SecurityStatusPalErrorCode.CompAndContinue }, { Interop.SECURITY_STATUS.CompleteNeeded, SecurityStatusPalErrorCode.CompleteNeeded }, { Interop.SECURITY_STATUS.ContextExpired, SecurityStatusPalErrorCode.ContextExpired }, + { Interop.SECURITY_STATUS.ContextExpiredError, SecurityStatusPalErrorCode.ContextExpiredError }, { Interop.SECURITY_STATUS.ContinueNeeded, SecurityStatusPalErrorCode.ContinueNeeded }, { Interop.SECURITY_STATUS.CredentialsNeeded, SecurityStatusPalErrorCode.CredentialsNeeded }, { Interop.SECURITY_STATUS.DecryptFailure, SecurityStatusPalErrorCode.DecryptFailure }, diff --git a/src/libraries/Common/src/System/Net/SecurityStatusPal.cs b/src/libraries/Common/src/System/Net/SecurityStatusPal.cs index 064aa974d6bb26..f3847b88397da4 100644 --- a/src/libraries/Common/src/System/Net/SecurityStatusPal.cs +++ b/src/libraries/Common/src/System/Net/SecurityStatusPal.cs @@ -71,6 +71,7 @@ internal enum SecurityStatusPalErrorCode DowngradeDetected, ApplicationProtocolMismatch, NoRenegotiation, - KeySetDoesNotExist + KeySetDoesNotExist, + ContextExpiredError } }