From 7f613acc88d0d2ed7daed6292016c6bad45b81de Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Wed, 20 Jul 2022 12:33:01 -0700 Subject: [PATCH 1/3] Add ServerCertFileName in the AuthProviderInfo to match the changes in SNI --- .../netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs | 2 ++ .../netfx/src/Microsoft/Data/SqlClient/TdsParser.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs index cf04e9c2ad..18ca7c68c2 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs @@ -182,6 +182,8 @@ internal struct AuthProviderInfo public bool certHash; public object clientCertificateCallbackContext; public SqlClientCertificateDelegate clientCertificateCallback; + [MarshalAs(UnmanagedType.LPWStr)] + public string serverCertFileName; }; internal struct CTAIPProviderInfo diff --git a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs index 664c6e56d5..4735fcf3ac 100644 --- a/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs +++ b/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs @@ -1193,6 +1193,7 @@ private void EnableSsl(uint info, SqlConnectionEncryptOption encrypt, bool integ authInfo.certHash = false; authInfo.clientCertificateCallbackContext = IntPtr.Zero; authInfo.clientCertificateCallback = null; + authInfo.serverCertFileName = null; if ((_encryptionOption & EncryptionOptions.CLIENT_CERT) != 0) { From e66a0fde9e237c3527918fb81fd924fc825a5562 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Thu, 28 Jul 2022 15:05:43 -0700 Subject: [PATCH 2/3] Update the version to match the latest release for SNI --- tools/props/Versions.props | 4 ++-- tools/specs/Microsoft.Data.SqlClient.nuspec | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/props/Versions.props b/tools/props/Versions.props index fab943ee95..23a1eb61ff 100644 --- a/tools/props/Versions.props +++ b/tools/props/Versions.props @@ -20,7 +20,7 @@ - 5.0.0-preview3.22165.1 + 5.0.0 4.3.1 4.3.0 @@ -38,7 +38,7 @@ 5.0.0 - 5.0.0-preview3.22165.1 + 5.0.0 5.0.0 1.0.0 5.0.0 diff --git a/tools/specs/Microsoft.Data.SqlClient.nuspec b/tools/specs/Microsoft.Data.SqlClient.nuspec index eccf5c441c..a9f0b2d6c7 100644 --- a/tools/specs/Microsoft.Data.SqlClient.nuspec +++ b/tools/specs/Microsoft.Data.SqlClient.nuspec @@ -28,7 +28,7 @@ When using NuGet 3.x this package requires at least version 3.4. sqlclient microsoft.data.sqlclient - + @@ -42,7 +42,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + @@ -61,7 +61,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + @@ -80,7 +80,7 @@ When using NuGet 3.x this package requires at least version 3.4. - + From 095629db2f1d56d44fb11dfb8208a10cc650c674 Mon Sep 17 00:00:00 2001 From: Lawrence LCI Date: Thu, 28 Jul 2022 16:09:42 -0700 Subject: [PATCH 3/3] Add serverCertFileName to AuthProviderInfo for netcore for latest SNI changes --- .../netcore/src/Interop/SNINativeMethodWrapper.Windows.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs b/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs index dd189d178a..eae47ef2f6 100644 --- a/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs +++ b/src/Microsoft.Data.SqlClient/netcore/src/Interop/SNINativeMethodWrapper.Windows.cs @@ -2,11 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Data.Common; -using Microsoft.Data.SqlClient; using System; using System.Runtime.InteropServices; using System.Text; +using Microsoft.Data.Common; +using Microsoft.Data.SqlClient; namespace Microsoft.Data.SqlClient { @@ -57,6 +57,8 @@ internal struct AuthProviderInfo public bool certHash; public object clientCertificateCallbackContext; public SqlClientCertificateDelegate clientCertificateCallback; + [MarshalAs(UnmanagedType.LPWStr)] + public string serverCertFileName; };