curl: Honor OPENSSL_NO_SSL2

Some OpenSSL distributions have dropped support for the ancient SSLv2
protocol completely.  Port changes from upstream curl to recognize this
case and avoid using it.
This commit is contained in:
Brad King 2012-09-07 13:23:45 -04:00
parent bc0e8c28ec
commit 8b51762426
3 changed files with 10 additions and 2 deletions

View File

@ -312,7 +312,7 @@ typedef enum {
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
CURLE_FAILED_INIT, /* 2 */ CURLE_FAILED_INIT, /* 2 */
CURLE_URL_MALFORMAT, /* 3 */ CURLE_URL_MALFORMAT, /* 3 */
CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */ CURLE_NOT_BUILT_IN, /* 4 */
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */
CURLE_COULDNT_CONNECT, /* 7 */ CURLE_COULDNT_CONNECT, /* 7 */

View File

@ -1285,8 +1285,13 @@ Curl_ossl_connect_step1(struct connectdata *conn,
req_method = TLSv1_client_method(); req_method = TLSv1_client_method();
break; break;
case CURL_SSLVERSION_SSLv2: case CURL_SSLVERSION_SSLv2:
#ifdef OPENSSL_NO_SSL2
failf(data, "OpenSSL was built without SSLv2 support");
return CURLE_NOT_BUILT_IN;
#else
req_method = SSLv2_client_method(); req_method = SSLv2_client_method();
break; break;
#endif
case CURL_SSLVERSION_SSLv3: case CURL_SSLVERSION_SSLv3:
req_method = SSLv3_client_method(); req_method = SSLv3_client_method();
break; break;

View File

@ -69,6 +69,10 @@ curl_easy_strerror(CURLcode error)
case CURLE_URL_MALFORMAT: case CURLE_URL_MALFORMAT:
return "URL using bad/illegal format or missing URL"; return "URL using bad/illegal format or missing URL";
case CURLE_NOT_BUILT_IN:
return "A requested feature, protocol or option was not found built-in in"
" this libcurl due to a build-time decision.";
case CURLE_COULDNT_RESOLVE_PROXY: case CURLE_COULDNT_RESOLVE_PROXY:
return "couldn't resolve proxy name"; return "couldn't resolve proxy name";
@ -287,7 +291,6 @@ curl_easy_strerror(CURLcode error)
return "Error in the SSH layer"; return "Error in the SSH layer";
/* error codes not used by current libcurl */ /* error codes not used by current libcurl */
case CURLE_URL_MALFORMAT_USER:
case CURLE_FTP_USER_PASSWORD_INCORRECT: case CURLE_FTP_USER_PASSWORD_INCORRECT:
case CURLE_MALFORMAT_USER: case CURLE_MALFORMAT_USER:
case CURLE_BAD_CALLING_ORDER: case CURLE_BAD_CALLING_ORDER: