[System]: ChainValidationHelper: ignore port number when validating a certificate...
authorMartin Baulig <martin.baulig@xamarin.com>
Sat, 1 Oct 2016 19:29:32 +0000 (21:29 +0200)
committerMartin Baulig <martin.baulig@xamarin.com>
Sat, 1 Oct 2016 19:34:01 +0000 (21:34 +0200)
(cherry picked from commit 4d28eb4b889d4f317675998f906cd9ca47440566)
(cherry picked from commit 7c88bf755ec19ecd7e6db578de329567ee41b8d0)

mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs

index ec38c2fd5d6b6dc912ebaf23c484aed19635b48f..b1921208fc85962e2152d26a75af67518eb98e37 100644 (file)
@@ -314,6 +314,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