Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
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
2 changes: 2 additions & 0 deletions src/System.Data.SqlClient/src/System.Data.SqlClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@
<Compile Include="System\Data\SqlClient\SNI\SNINpHandle.cs" />
<Compile Include="System\Data\SqlClient\SNI\SNIPacket.cs" />
<Compile Include="System\Data\SqlClient\SNI\SNIProxy.cs" />
<Compile Include="System\Data\SqlClient\SNI\SNIProxy.Windows.cs" Condition="'$(TargetsNetCoreApp)' != 'true' OR '$(TargetsUnix)' != 'true'" />
<Compile Include="System\Data\SqlClient\SNI\SNIProxy.Unix.cs" Condition="'$(TargetsNetCoreApp)' == 'true' AND '$(TargetsUnix)' == 'true'" />
<Compile Include="System\Data\SqlClient\SNI\SNITcpHandle.cs" />
<Compile Include="System\Data\SqlClient\SNI\SslOverTdsStream.cs" />
<Compile Include="System\Data\SqlClient\SNI\SNICommon.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Data.SqlClient.SNI
{
/// <summary>
/// Managed SNI proxy implementation. Contains many SNI entry points used by SqlClient.
/// </summary>
internal partial class SNIProxy
{
// On Unix/Linux the format for the SPN is SERVICE@HOST. This is because the System.Net.Security.Native
// GSS-API layer uses GSS_C_NT_HOSTBASED_SERVICE format for the SPN.
private const string SpnServiceHostSeparator = "@";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

namespace System.Data.SqlClient.SNI
{
/// <summary>
/// Managed SNI proxy implementation. Contains many SNI entry points used by SqlClient.
/// </summary>
internal partial class SNIProxy
{
// On Windows the format for the SPN is SERVICE/HOST. So the separator character between the
// SERVICE and HOST components is "/".
private const string SpnServiceHostSeparator = "/";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace System.Data.SqlClient.SNI
/// <summary>
/// Managed SNI proxy implementation. Contains many SNI entry points used by SqlClient.
/// </summary>
internal class SNIProxy
internal partial class SNIProxy
{
private const int DefaultSqlServerPort = 1433;
private const int DefaultSqlServerDacPort = 1434;
Expand Down Expand Up @@ -342,7 +342,7 @@ private static byte[] GetSqlServerSPN(string hostNameOrAddress, string portOrIns
// If the DNS lookup failed, then resort to using the user provided hostname to construct the SPN.
fullyQualifiedDomainName = hostEntry?.HostName ?? hostNameOrAddress;
}
string serverSpn = SqlServerSpnHeader + "/" + fullyQualifiedDomainName;
string serverSpn = SqlServerSpnHeader + SpnServiceHostSeparator + fullyQualifiedDomainName;
if (!string.IsNullOrWhiteSpace(portOrInstanceName))
{
serverSpn += ":" + portOrInstanceName;
Expand Down