Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit e43901d

Browse files
authored
SslStream IDN mapping host name on Windows (#28725)
* SslStream IDN mapping host name on Windows * Update SniHelper.cs
1 parent d8ee1a7 commit e43901d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Common/src/Interop/Windows/sspicli/SecuritySafeHandles.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.Win32.SafeHandles;
66

77
using System.Diagnostics;
8+
using System.Globalization;
89
using System.Runtime.InteropServices;
910
using System.Security.Authentication.ExtendedProtection;
1011

@@ -444,6 +445,7 @@ internal abstract partial class SafeDeleteContext : SafeHandle
444445
#endif
445446
private const string dummyStr = " ";
446447
private static readonly byte[] s_dummyBytes = new byte[] { 0 };
448+
private static readonly IdnMapping s_idnMapping = new IdnMapping();
447449

448450
protected SafeFreeCredentials _EffectiveCredential;
449451

@@ -592,7 +594,8 @@ internal static unsafe int InitializeSecurityContext(
592594
targetName = dummyStr;
593595
}
594596

595-
fixed (char* namePtr = targetName)
597+
string punyCode = s_idnMapping.GetAscii(targetName);
598+
fixed (char* namePtr = punyCode)
596599
{
597600
errorCode = MustRunInitializeSecurityContext_SECURITY(
598601
ref inCredentials,

0 commit comments

Comments
 (0)