From 73875c9ecb0b9d48262b52da25114cafcc403deb Mon Sep 17 00:00:00 2001
From: Lawrence LCI <31262254+lcheunglci@users.noreply.github.com>
Date: Thu, 4 Aug 2022 12:30:20 -0700
Subject: [PATCH] Addressing HostNameInCertificate changes in native SNI
(#1680)
---
.../netcore/src/Interop/SNINativeMethodWrapper.Windows.cs | 6 ++++--
.../src/Microsoft/Data/Interop/SNINativeMethodWrapper.cs | 2 ++
.../netfx/src/Microsoft/Data/SqlClient/TdsParser.cs | 1 +
tools/props/Versions.props | 4 ++--
tools/specs/Microsoft.Data.SqlClient.nuspec | 8 ++++----
5 files changed, 13 insertions(+), 8 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;
};
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 81cf52efe6..e116885cd2 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
@@ -1195,6 +1195,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)
{
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.
-
+