aboutsummaryrefslogtreecommitdiff
path: root/lib/curl_darwinssl.c
diff options
context:
space:
mode:
authorOscar Koeroo <okoeroo@gmail.com>2012-11-03 02:06:51 +0100
committerDaniel Stenberg <daniel@haxx.se>2012-11-08 22:23:12 +0100
commit1394cad30fcac7eb21adb9158dfcfab10e9f53d4 (patch)
treea4c89ce32f9f5fb1da8c69e1b44ba6005d6b2a96 /lib/curl_darwinssl.c
parent18c0e9bd71009792982dc6cf518427c13c8674a0 (diff)
SSL: Several SSL-backend related fixes
axTLS: This will make the axTLS backend perform the RFC2818 checks, honoring the VERIFYHOST setting similar to the OpenSSL backend. Generic for OpenSSL and axTLS: Move the hostcheck and cert_hostcheck functions from the lib/ssluse.c files to make them genericly available for both the OpenSSL, axTLS and other SSL backends. They are now in the new lib/hostcheck.c file. CyaSSL: CyaSSL now also has the RFC2818 checks enabled by default. There is a limitation that the verifyhost can not be enabled exclusively on the Subject CN field comparison. This SSL backend will thus behave like the NSS and the GnuTLS (meaning: RFC2818 ok, or bust). In other words: setting verifyhost to 0 or 1 will disable the Subject Alt Names checks too. Schannel: Updated the schannel information messages: Split the IP address usage message from the verifyhost setting and changed the message about disabling SNI (Server Name Indication, used in HTTP virtual hosting) into a message stating that the Subject Alternative Names checks are being disabled when verifyhost is set to 0 or 1. As a side effect of switching off the RFC2818 related servername checks with SCH_CRED_NO_SERVERNAME_CHECK (http://msdn.microsoft.com/en-us/library/aa923430.aspx) the SNI feature is being disabled. This effect is not documented in MSDN, but Wireshark output clearly shows the effect (details on the libcurl maillist). PolarSSL: Fix the prototype change in PolarSSL of ssl_set_session() and the move of the peer_cert from the ssl_context to the ssl_session. Found this change in the PolarSSL SVN between r1316 and r1317 where the POLARSSL_VERSION_NUMBER was at 0x01010100. But to accommodate the Ubuntu PolarSSL version 1.1.4 the check is to discriminate between lower then PolarSSL version 1.2.0 and 1.2.0 and higher. Note: The PolarSSL SVN trunk jumped from version 1.1.1 to 1.2.0. Generic: All the SSL backends are fixed and checked to work with the ssl.verifyhost as a boolean, which is an internal API change.
Diffstat (limited to 'lib/curl_darwinssl.c')
-rw-r--r--lib/curl_darwinssl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/curl_darwinssl.c b/lib/curl_darwinssl.c
index 334944f09..3cc278a1f 100644
--- a/lib/curl_darwinssl.c
+++ b/lib/curl_darwinssl.c
@@ -803,6 +803,8 @@ static CURLcode darwinssl_connect_step1(struct connectdata *conn,
}
#endif /* defined(__MAC_10_6) || defined(__IPHONE_5_0) */
+ /* If this is a domain name and not an IP address, then configure SNI.
+ * Also: the verifyhost setting influences SNI usage */
/* If this is a domain name and not an IP address, then configure SNI: */
if((0 == Curl_inet_pton(AF_INET, conn->host.name, &addr)) &&
#ifdef ENABLE_IPV6
@@ -862,7 +864,6 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
connssl->connecting_state = connssl->ssl_direction ?
ssl_connect_2_writing : ssl_connect_2_reading;
return CURLE_OK;
- break;
case errSSLServerAuthCompleted:
/* the documentation says we need to call SSLHandshake() again */
@@ -874,13 +875,16 @@ darwinssl_connect_step2(struct connectdata *conn, int sockindex)
case errSSLCertExpired:
failf(data, "SSL certificate problem: OSStatus %d", err);
return CURLE_SSL_CACERT;
- break;
+
+ case errSSLHostNameMismatch:
+ failf(data, "SSL certificate peer verification failed, the "
+ "certificate did not match \"%s\"\n", conn->host.dispname);
+ return CURLE_PEER_FAILED_VERIFICATION;
default:
failf(data, "Unknown SSL protocol error in connection to %s:%d",
conn->host.name, err);
return CURLE_SSL_CONNECT_ERROR;
- break;
}
}
else {