diff options
author | Martin Baulig <martin.baulig@xamarin.com> | 2016-10-01 22:29:32 +0300 |
---|---|---|
committer | Sebastien Pouliot <sebastien@xamarin.com> | 2016-10-03 20:59:13 +0300 |
commit | ef43c151e2bfee5f1e86ea3d6e375472028a013a (patch) | |
tree | 7d874b01f4f585fb45079a9e68842c6794c1e6a0 | |
parent | 1e1393ff1cf28c56603925d3e9bc2068f6bdb042 (diff) |
[System]: ChainValidationHelper: ignore port number when validating a certificate's host name.mono-4.6.1.5mono-4.6.0-branch-c8sr0
(cherry picked from commit 4d28eb4b889d4f317675998f906cd9ca47440566)
(cherry picked from commit 7c88bf755ec19ecd7e6db578de329567ee41b8d0)
This fixes the certificate validation bug here:
https://bugzilla.xamarin.com/show_bug.cgi?id=44708
-rw-r--r-- | mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs b/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs index 5d2812d2738..58d5c3865bb 100644 --- a/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs +++ b/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs @@ -305,6 +305,13 @@ namespace Mono.Net.Security return new ValidationResult (result, user_denied, 0, (MonoSslPolicyErrors)errors); } + // Ignore port number when validating certificates. + if (!string.IsNullOrEmpty (host)) { + var pos = host.IndexOf (':'); + if (pos > 0) + host = host.Substring (0, pos); + } + ICertificatePolicy policy = ServicePointManager.GetLegacyCertificatePolicy (); int status11 = 0; // Error code passed to the obsolete ICertificatePolicy callback |