Merge pull request #409 from Alkarex/patch-1
[mono.git] / mcs / class / System / System.Net / DefaultCertificatePolicy.cs
index 88c6c8b58029f2927de15b7c5cdc9a88773ba3c4..011c295a5eae34cceb518fb174fd1df816cfe591 100644 (file)
@@ -1,11 +1,11 @@
-//\r
-// System.Net.DefaultCertificatePolicy: Default policy applicable to \r
-//\r
-// Authors:\r
+//
+// System.Net.DefaultCertificatePolicy: Default policy applicable to 
+//
+// Authors:
 //     Sebastien Pouliot  <sebastien@ximian.com>
 //
-// Copyright (C) 2004 Novell (http://www.novell.com)\r
-//\r
+// Copyright (C) 2004 Novell (http://www.novell.com)
+//
 
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 using System.Security.Cryptography.X509Certificates;
 
 namespace System.Net {
-\r
+
        internal class DefaultCertificatePolicy : ICertificatePolicy {
 
                // This is the same default policy as used by the .NET 
                // framework. It accepts valid certificates and (valid
-               // but) expired certificates.\r
-               public bool CheckValidationResult (ServicePoint point, X509Certificate certificate, WebRequest request, int certificateProblem)\r
+               // but) expired certificates.
+               public bool CheckValidationResult (ServicePoint point, X509Certificate certificate, WebRequest request, int certificateProblem)
                {
+#if SECURITY_DEP
+                       // If using default policy and the new callback is there, ignore this
+                       if (ServicePointManager.ServerCertificateValidationCallback != null)
+                               return true;
+#endif
                        switch (certificateProblem) {
                                case 0:                 // No error
                                case -2146762495:       // CERT_E_EXPIRED 0x800B0101 (WinError.h)
                                        return true;
                                default:
                                        return false;
-                       }\r
-               }\r
-       }\r
+                       }
+               }
+       }
 }
+