Always call SSPIWrapper.CheckRemoteCertificate().
authorMartin Baulig <martin.baulig@xamarin.com>
Mon, 11 May 2015 22:03:12 +0000 (00:03 +0200)
committerMarek Safar <marek.safar@gmail.com>
Mon, 2 May 2016 22:10:14 +0000 (00:10 +0200)
mcs/class/referencesource/System/net/System/Net/_SecureChannel.cs

index 2730f8a0e60eb7f038a9569171c9914da71912e4..d855fed90a0a9669fde7afa79e14b130a7b59a5b 100644 (file)
@@ -1296,13 +1296,6 @@ namespace System.Net.Security {
             // we don't catch exceptions in this method, so it's safe for "accepted" be initialized with true
             bool success = false;
 
-#if MONO
-            if (IsServer)
-                // FIXME
-                success = true;
-            else
-                success = SSPIWrapper.CheckRemoteCertificate(m_SecurityContext);
-#else
             X509Chain chain = null;
             X509Certificate2 remoteCertificateEx = null;
 
@@ -1316,6 +1309,7 @@ namespace System.Net.Security {
                     GlobalLog.Leave("SecureChannel#" + ValidationHelper.HashString(this) + "::VerifyRemoteCertificate (no remote cert)", (!m_RemoteCertRequired).ToString());
                     sslPolicyErrors |= SslPolicyErrors.RemoteCertificateNotAvailable;
                 }
+#if !MONO
                 else
                 {
                     chain = new X509Chain();
@@ -1368,6 +1362,9 @@ namespace System.Net.Security {
                     else
                         success = (sslPolicyErrors == SslPolicyErrors.None);
                 }
+#else
+               success = SSPIWrapper.CheckRemoteCertificate(m_SecurityContext);
+#endif
 
                 if (Logging.On) {
                     if (sslPolicyErrors != SslPolicyErrors.None)
@@ -1406,7 +1403,6 @@ namespace System.Net.Security {
                     remoteCertificateEx.Reset();
             }
             GlobalLog.Leave("SecureChannel#" + ValidationHelper.HashString(this) + "::VerifyRemoteCertificate", success.ToString());
-#endif
             return success;
         }