mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
made new ssl activate function the default.
This commit is contained in:
parent
fb9bd8d20a
commit
714eb8069a
@ -227,10 +227,10 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
int ssl_ret = FAILURE;
|
||||
switch(ssl_flags) {
|
||||
case php_ssl_v23:
|
||||
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, SSLv23_client_method() TSRMLS_CC);
|
||||
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, SSLv23_client_method(), NULL TSRMLS_CC);
|
||||
break;
|
||||
case php_ssl_tls:
|
||||
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, TLSv1_client_method() TSRMLS_CC);
|
||||
ssl_ret = php_stream_sock_ssl_activate_with_method(stream, 1, TLSv1_client_method(), NULL TSRMLS_CC);
|
||||
break;
|
||||
default:
|
||||
/* unknown ?? */
|
||||
|
@ -204,7 +204,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
|
||||
}
|
||||
|
||||
if (use_ssl) {
|
||||
if (use_ssl && php_stream_sock_ssl_activate_with_method(stream, 1, SSLv23_method()) == FAILURE) {
|
||||
if (use_ssl && php_stream_sock_ssl_activate(stream, 1) == FAILURE) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
|
||||
php_stream_close(stream);
|
||||
stream = NULL;
|
||||
@ -415,7 +415,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, char *path, ch
|
||||
php_stream_notify_progress_init(context, 0, file_size);
|
||||
|
||||
#if HAVE_OPENSSL_EXT
|
||||
if (use_ssl_on_data && php_stream_sock_ssl_activate_with_method_ex(datastream, 1, SSLv23_method(), reuseid) == FAILURE) {
|
||||
if (use_ssl_on_data && php_stream_sock_ssl_activate_with_method(datastream, 1, SSLv23_method(), reuseid) == FAILURE) {
|
||||
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
|
||||
php_stream_close(datastream);
|
||||
datastream = NULL;
|
||||
|
@ -602,20 +602,25 @@ PHPAPI php_stream *_php_stream_sock_open_unix(const char *path, int pathlen, int
|
||||
}
|
||||
|
||||
#if HAVE_OPENSSL_EXT
|
||||
PHPAPI int php_stream_sock_ssl_activate_with_method_ex(php_stream *stream, int activate, SSL_METHOD *method, php_stream *control TSRMLS_DC)
|
||||
PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method, php_stream *session_stream TSRMLS_DC)
|
||||
{
|
||||
php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract;
|
||||
php_netstream_data_t *psock = NULL;
|
||||
SSL_CTX *ctx = NULL;
|
||||
|
||||
if (control) {
|
||||
psock = (php_netstream_data_t*)control->abstract;
|
||||
}
|
||||
|
||||
if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_stream_sock_ssl_activate_with_method: stream is not a network stream");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (session_stream) {
|
||||
if (!php_stream_is(session_stream, PHP_STREAM_IS_SOCKET)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_stream_sock_ssl_activate_with_method: session_stream is not a network stream");
|
||||
return FAILURE;
|
||||
}
|
||||
psock = (php_netstream_data_t*)session_stream->abstract;
|
||||
}
|
||||
|
||||
if (activate == sock->ssl_active)
|
||||
return SUCCESS; /* already in desired mode */
|
||||
|
@ -148,9 +148,8 @@ PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *time
|
||||
PHPAPI size_t php_stream_sock_set_chunk_size(php_stream *stream, size_t size TSRMLS_DC);
|
||||
|
||||
#if HAVE_OPENSSL_EXT
|
||||
PHPAPI int php_stream_sock_ssl_activate_with_method_ex(php_stream *stream, int activate, SSL_METHOD *method, php_stream *control TSRMLS_DC);
|
||||
#define php_stream_sock_ssl_activate_with_method(stream, activate, method) php_stream_sock_ssl_activate_with_method_ex((stream), (activate), SSLv23_client_method(), NULL TSRMLS_CC)
|
||||
#define php_stream_sock_ssl_activate(stream, activate) php_stream_sock_ssl_activate_with_method((stream), (activate), SSLv23_client_method() TSRMLS_CC)
|
||||
PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method, php_stream *session_stream TSRMLS_DC);
|
||||
#define php_stream_sock_ssl_activate(stream, activate) php_stream_sock_ssl_activate_with_method((stream), (activate), SSLv23_client_method(), NULL TSRMLS_CC)
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user