]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
darwinssl: Make certificate errors less techy
authorNick Zitzmann <nickzman@gmail.com>
Sat, 9 Feb 2013 01:34:11 +0000 (18:34 -0700)
committerNick Zitzmann <nickzman@gmail.com>
Sat, 9 Feb 2013 01:34:11 +0000 (18:34 -0700)
Previously if a problem was found with one of the server's certificates,
we'd log an OSStatus for the end user to look up. Now we explain what
was wrong with the site's certificate chain. Also un-did part of the
previous commit where the code wouldn't catch errSSLServerAuthCompleted
if built under Leopard.

lib/curl_darwinssl.c

index e81e7a637fd8f89ed6e62d818842316e33b4e58e..d660deb2d66b9023dee0094a58b0655ce46e7da7 100644 (file)
@@ -940,17 +940,24 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
             ssl_connect_2_writing : ssl_connect_2_reading;
         return CURLE_OK;
 
-#if defined(__MAC_10_6) || defined(__IPHONE_5_0)
-      case errSSLServerAuthCompleted:
+      /* The below is errSSLServerAuthCompleted; it's not defined in
+        Leopard's headers */
+      case -9841:
         /* the documentation says we need to call SSLHandshake() again */
         return darwinssl_connect_step2(conn, sockindex);
-#endif /* defined(__MAC_10_6) || defined(__IPHONE_5_0) */
 
       case errSSLXCertChainInvalid:
+        failf(data, "SSL certificate problem: Invalid certificate chain");
+        return CURLE_SSL_CACERT;
       case errSSLUnknownRootCert:
+        failf(data, "SSL certificate problem: Untrusted root certificate");
+        return CURLE_SSL_CACERT;
       case errSSLNoRootCert:
+        failf(data, "SSL certificate problem: No root certificate");
+        return CURLE_SSL_CACERT;
       case errSSLCertExpired:
-        failf(data, "SSL certificate problem: OSStatus %d", err);
+        failf(data, "SSL certificate problem: Certificate chain had an "
+              "expired certificate");
         return CURLE_SSL_CACERT;
 
       case errSSLHostNameMismatch: