Skip to content

Commit 380c3e5

Browse files
committed
SSLV2 patch cleanup
1 parent 6336b28 commit 380c3e5

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

ext/openssl/openssl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,9 @@ PHP_MINIT_FUNCTION(openssl)
11111111

11121112
php_stream_xport_register("ssl", php_openssl_ssl_socket_factory TSRMLS_CC);
11131113
php_stream_xport_register("sslv3", php_openssl_ssl_socket_factory TSRMLS_CC);
1114+
#ifndef OPENSSL_NO_SSL2
11141115
php_stream_xport_register("sslv2", php_openssl_ssl_socket_factory TSRMLS_CC);
1116+
#endif
11151117
php_stream_xport_register("tls", php_openssl_ssl_socket_factory TSRMLS_CC);
11161118

11171119
/* override the default tcp socket provider */
@@ -1146,7 +1148,9 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
11461148
php_unregister_url_stream_wrapper("ftps" TSRMLS_CC);
11471149

11481150
php_stream_xport_unregister("ssl" TSRMLS_CC);
1151+
#ifndef OPENSSL_NO_SSL2
11491152
php_stream_xport_unregister("sslv2" TSRMLS_CC);
1153+
#endif
11501154
php_stream_xport_unregister("sslv3" TSRMLS_CC);
11511155
php_stream_xport_unregister("tls" TSRMLS_CC);
11521156

ext/openssl/xp_ssl.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,8 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
330330
break;
331331
case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
332332
#ifdef OPENSSL_NO_SSL2
333-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled in openSSL");
334-
return -1;
333+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled into the openSSL library PHP is linked against");
334+
return -1;
335335
#else
336336
sslsock->is_client = 1;
337337
method = SSLv2_client_method();
@@ -355,8 +355,8 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
355355
break;
356356
case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
357357
#ifdef OPENSSL_NO_SSL2
358-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled in openSSL");
359-
return -1;
358+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled into the openSSL library PHP is linked against");
359+
return -1;
360360
#else
361361
sslsock->is_client = 0;
362362
method = SSLv2_server_method();
@@ -922,8 +922,13 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, long protolen,
922922
sslsock->enable_on_connect = 1;
923923
sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
924924
} else if (strncmp(proto, "sslv2", protolen) == 0) {
925+
#ifdef OPENSSL_NO_SSL2
926+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled into the openSSL library PHP is linked against");
927+
return NULL;
928+
#else
925929
sslsock->enable_on_connect = 1;
926930
sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
931+
#endif
927932
} else if (strncmp(proto, "sslv3", protolen) == 0) {
928933
sslsock->enable_on_connect = 1;
929934
sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;

0 commit comments

Comments
 (0)