Skip to content

Commit f1806e6

Browse files
committed
Support for openssl without SSLv2 supprot compiled in. Distros are starting to
remove support now and this wasn't compiling anymore on my Debian dev box.
1 parent 999790a commit f1806e6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

ext/openssl/xp_ssl.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,14 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
329329
method = SSLv23_client_method();
330330
break;
331331
case STREAM_CRYPTO_METHOD_SSLv2_CLIENT:
332+
#ifdef OPENSSL_NO_SSL2
333+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled in openSSL");
334+
return -1;
335+
#else
332336
sslsock->is_client = 1;
333337
method = SSLv2_client_method();
334338
break;
339+
#endif
335340
case STREAM_CRYPTO_METHOD_SSLv3_CLIENT:
336341
sslsock->is_client = 1;
337342
method = SSLv3_client_method();
@@ -349,9 +354,14 @@ static inline int php_openssl_setup_crypto(php_stream *stream,
349354
method = SSLv3_server_method();
350355
break;
351356
case STREAM_CRYPTO_METHOD_SSLv2_SERVER:
357+
#ifdef OPENSSL_NO_SSL2
358+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSLv2 support is not compiled in openSSL");
359+
return -1;
360+
#else
352361
sslsock->is_client = 0;
353362
method = SSLv2_server_method();
354363
break;
364+
#endif
355365
case STREAM_CRYPTO_METHOD_TLS_SERVER:
356366
sslsock->is_client = 0;
357367
method = TLSv1_server_method();

0 commit comments

Comments
 (0)