Skip to content

Commit

Permalink
Addressing HostNameInCertificate changes in native SNI (#1680)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcheunglci authored Aug 4, 2022
1 parent 53b9f0a commit 73875c9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -57,6 +57,8 @@ internal struct AuthProviderInfo
public bool certHash;
public object clientCertificateCallbackContext;
public SqlClientCertificateDelegate clientCertificateCallback;
[MarshalAs(UnmanagedType.LPWStr)]
public string serverCertFileName;
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions tools/props/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>
<!-- NetFx project dependencies -->
<PropertyGroup>
<MicrosoftDataSqlClientSniVersion>5.0.0-preview3.22165.1</MicrosoftDataSqlClientSniVersion>
<MicrosoftDataSqlClientSniVersion>5.0.0</MicrosoftDataSqlClientSniVersion>
<SystemSecurityCryptographyAlgorithmsVersion>4.3.1</SystemSecurityCryptographyAlgorithmsVersion>
<SystemSecurityCryptographyPrimitivesVersion>4.3.0</SystemSecurityCryptographyPrimitivesVersion>
</PropertyGroup>
Expand All @@ -38,7 +38,7 @@
<!-- NetCore project dependencies -->
<PropertyGroup>
<MicrosoftWin32RegistryVersion>5.0.0</MicrosoftWin32RegistryVersion>
<MicrosoftDataSqlClientSNIRuntimeVersion>5.0.0-preview3.22165.1</MicrosoftDataSqlClientSNIRuntimeVersion>
<MicrosoftDataSqlClientSNIRuntimeVersion>5.0.0</MicrosoftDataSqlClientSNIRuntimeVersion>
<SystemConfigurationConfigurationManagerVersion>5.0.0</SystemConfigurationConfigurationManagerVersion>
<MicrosoftSqlServerServerVersion>1.0.0</MicrosoftSqlServerServerVersion>
<SystemDiagnosticsDiagnosticSourceVersion>5.0.0</SystemDiagnosticsDiagnosticSourceVersion>
Expand Down
8 changes: 4 additions & 4 deletions tools/specs/Microsoft.Data.SqlClient.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<tags>sqlclient microsoft.data.sqlclient</tags>
<dependencies>
<group targetFramework="net462">
<dependency id="Microsoft.Data.SqlClient.SNI" version="5.0.0-preview3.22165.1" />
<dependency id="Microsoft.Data.SqlClient.SNI" version="5.0.0" />
<dependency id="Azure.Identity" version="1.6.0" />
<dependency id="Microsoft.Identity.Client" version="4.45.0" />
<dependency id="Microsoft.IdentityModel.JsonWebTokens" version="6.21.0" />
Expand All @@ -42,7 +42,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Text.Encodings.Web" version="4.7.2" />
</group>
<group targetFramework="netcoreapp3.1">
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="5.0.0-preview3.22165.1" exclude="Compile" />
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="5.0.0" exclude="Compile" />
<dependency id="Azure.Identity" version="1.6.0" />
<dependency id="Microsoft.Identity.Client" version="4.45.0" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.21.0" />
Expand All @@ -61,7 +61,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Security.Principal.Windows" version="5.0.0" exclude="Compile" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="5.0.0-preview3.22165.1" exclude="Compile" />
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="5.0.0" exclude="Compile" />
<dependency id="Azure.Identity" version="1.6.0" />
<dependency id="Microsoft.Identity.Client" version="4.45.0" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.21.0" />
Expand All @@ -80,7 +80,7 @@ When using NuGet 3.x this package requires at least version 3.4.</description>
<dependency id="System.Security.Principal.Windows" version="5.0.0" exclude="Compile" />
</group>
<group targetFramework="netstandard2.1">
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="5.0.0-preview3.22165.1" exclude="Compile" />
<dependency id="Microsoft.Data.SqlClient.SNI.runtime" version="5.0.0" exclude="Compile" />
<dependency id="Azure.Identity" version="1.6.0" />
<dependency id="Microsoft.Identity.Client" version="4.45.0" exclude="Compile"/>
<dependency id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.21.0" />
Expand Down

0 comments on commit 73875c9

Please sign in to comment.