Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/ftp/tests/server.inc
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ if ($pid) {
}


if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
die("SSLv23 handshake failed.\n");
}

if (empty($m[1]) || $m[1] !== 'emptydir') {
fputs($fs, "file1\r\nfile1\r\nfile\nb0rk\r\n");
}
Expand Down Expand Up @@ -403,10 +407,6 @@ if ($pid) {

$pasvs = stream_socket_accept($soc,10);

if ((!empty($ssl)) && (!stream_socket_enable_crypto($pasvs, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER))) {
die("SSLv23 handshake failed.\n");
}

}elseif (preg_match('/^EPSV/', $buf, $matches)) {
fputs($s, "550 Extended passsive mode not supported.\r\n");
} elseif (preg_match('/^SITE EXEC/', $buf, $matches)) {
Expand Down
22 changes: 11 additions & 11 deletions ext/standard/ftp_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,17 +737,6 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat
goto opendir_errexit;
}

php_stream_context_set(datastream, context);
if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
php_stream_xport_crypto_enable(datastream, 1 TSRMLS_CC) < 0)) {

php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
php_stream_close(datastream);
datastream = NULL;
goto opendir_errexit;
}


php_stream_printf(stream TSRMLS_CC, "NLST %s\r\n", (resource->path != NULL ? resource->path : "/"));

Expand All @@ -761,6 +750,17 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat
goto opendir_errexit;
}

php_stream_context_set(datastream, context);
if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
php_stream_xport_crypto_enable(datastream, 1 TSRMLS_CC) < 0)) {

php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode");
php_stream_close(datastream);
datastream = NULL;
goto opendir_errexit;
}

php_url_free(resource);

dirsdata = emalloc(sizeof *dirsdata);
Expand Down