Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix | Skip the CRL check during authenticaiton #1559

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public override uint EnableSsl(uint options)
_validateCert = (options & TdsEnums.SNI_SSL_VALIDATE_CERTIFICATE) != 0;
try
{
_sslStream.AuthenticateAsClient(_targetServer, null, SupportedProtocols, true);
_sslStream.AuthenticateAsClient(_targetServer, null, SupportedProtocols, false);
_sslOverTdsStream.FinishHandshake();
}
catch (AuthenticationException aue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,27 +578,29 @@ private static async void ParallelConnectHelper(
/// </summary>
public override uint EnableSsl(uint options)
{
_validateCert = (options & TdsEnums.SNI_SSL_VALIDATE_CERTIFICATE) != 0;

try
{
_sslStream.AuthenticateAsClient(_targetServer, null, SupportedProtocols, true);
_sslOverTdsStream.FinishHandshake();
}
catch (AuthenticationException aue)
using (TrySNIEventScope.Create(nameof(SNIHandle)))
{
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.ERR, "Connection Id {0}, Authentication exception occurred: {1}", args0: _connectionId, args1: aue?.Message);
return ReportTcpSNIError(aue, SNIError.CertificateValidationErrorCode);
}
catch (InvalidOperationException ioe)
{
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.ERR, "Connection Id {0}, Invalid Operation Exception occurred: {1}", args0: _connectionId, args1: ioe?.Message);
return ReportTcpSNIError(ioe);
}
_validateCert = (options & TdsEnums.SNI_SSL_VALIDATE_CERTIFICATE) != 0;
try
{
_sslStream.AuthenticateAsClient(_targetServer, null, SupportedProtocols, false);
_sslOverTdsStream.FinishHandshake();
}
catch (AuthenticationException aue)
{
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.ERR, "Connection Id {0}, Authentication exception occurred: {1}", args0: _connectionId, args1: aue?.Message);
return ReportTcpSNIError(aue, SNIError.CertificateValidationErrorCode);
}
catch (InvalidOperationException ioe)
{
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.ERR, "Connection Id {0}, Invalid Operation Exception occurred: {1}", args0: _connectionId, args1: ioe?.Message);
return ReportTcpSNIError(ioe);
}

_stream = _sslStream;
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.INFO, "Connection Id {0}, SSL enabled successfully.", args0: _connectionId);
return TdsEnums.SNI_SUCCESS;
_stream = _sslStream;
SqlClientEventSource.Log.TrySNITraceEvent(nameof(SNITCPHandle), EventType.INFO, "Connection Id {0}, SSL enabled successfully.", args0: _connectionId);
return TdsEnums.SNI_SUCCESS;
}
}

/// <summary>
Expand Down