Bug #41021 [NoF->Csd]: Problems with the ftps wrapper.

From: Date: Sat, 23 Jul 2016 12:08:32 +0000
Subject: Bug #41021 [NoF->Csd]: Problems with the ftps wrapper.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-202524@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=41021&edit=1

 ID:                 41021
 Updated by:         nikic@php.net
 Reported by:        webmaster at wiedmann-online dot de
 Summary:            Problems with the ftps wrapper.
-Status:             No Feedback
+Status:             Closed
 Type:               Bug
 Package:            FTP related
 Operating System:   Windows_NT
 PHP Version:        5.2.1
 Assigned To:        pollita
 Block user comment: N
 Private report:     N

 New Comment:

Fixed by https://github.com/php/php-src/commit/65abdb556ddf67068951020b8829c0817697a84e
in 5.6+.


Previous Comments:
------------------------------------------------------------------------
[2016-07-21 09:49:27] vhu at iki dot fi

I was able to reproduce Test 1 (issue with scandir()) with 5.6.13 as well as and today's
php-src/master from github.

Problem with scandir() is fixed with the same patch as opendir() problem listed in bug #54431.

------------------------------------------------------------------------
[2008-07-21 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------
[2008-07-13 16:11:54] jani@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi



------------------------------------------------------------------------
[2007-04-09 07:34:41] tony2001@php.net

Sara, could you plz take a look at this?

------------------------------------------------------------------------
[2007-04-08 03:47:00] webmaster at wiedmann-online dot de

Description:
------------
I've played with the ftps wrapper, but some issues with it.

- scandir() doesn't work at all. (test 1)
- With file_get_contents() I get the content, but also a warning. (test 2)
(the same behaviour I have with an older PHP (5.0.4) on *nix with both tests)

- An additional test with ftp_ssl_connect() works only on *nix (PHP 5.0.4) but not on Windows (PHP
5.1.4, not an official build). (test 3)

With some other ftp clients, I have no problems.


Reproduce code:
---------------
*** TEST 1 ***
[php script]
<?php
error_reporting(E_ALL);
print_r(scandir('ftps://foo:bar@bsdserver-1-node3:21/'));
?> 


*** TEST 2 ***
[explorer.bat (file on ftp server)]
cd \
cd Windows
explorer.exe
pause

[php script]
<?php
error_reporting(E_ALL);
print_r(file_get_contents('ftps://foo:bar@bsdserver-1-node3:21/anonymous/tmp/explorer.bat'));
?>


*** TEST 3 ***
[php script]
<?php
error_reporting(E_ALL);
$conn_id = ftp_ssl_connect('bsdserver-1-node3', 21);
$login_result = ftp_login($conn_id, 'foo', 'bar');
$contents = ftp_nlist($conn_id, '/');
var_dump($contents);
?> 


Expected result:
----------------
It should work (and without warnings) ;-)

But I have logs with working connections from a ftp client (connect / list directory / disconnect)
on the same windows box as PHP:

[FTP over TLS explicit / ftp server log]
Apr 07 21:07:30 mod_tls/2.0.7[39949]: TLS/TLS-C requested, starting TLS handshake
Apr 07 21:07:32 mod_tls/2.0.7[39949]: TLSv1/SSLv3 connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)
Apr 07 21:07:33 mod_tls/2.0.7[39949]: Protection set to Private
Apr 07 21:07:33 mod_tls/2.0.7[39949]: starting TLS negotiation on data connection
Apr 07 21:07:33 mod_tls/2.0.7[39949]: TLSv1/SSLv3 data connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)


[FTP over SSL explicit / ftp server log]
Apr 07 21:04:14 mod_tls/2.0.7[39934]: SSL/TLS-P requested, starting TLS handshake
Apr 07 21:04:16 mod_tls/2.0.7[39934]: TLSv1/SSLv3 connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)
Apr 07 21:04:17 mod_tls/2.0.7[39934]: Protection set to Private
Apr 07 21:04:17 mod_tls/2.0.7[39934]: starting TLS negotiation on data connection
Apr 07 21:04:18 mod_tls/2.0.7[39934]: TLSv1/SSLv3 data connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)


Actual result:
--------------
*** TEST 1 ***
[cli output]
c:\php-5.2.1>php test.php
Warning: scandir(): SSL/TLS already set-up for this stream in c:\php-5.2.1\test.php on line 3
Warning: scandir(ftps://...@bsdserver-1-node1:21/): failed to open dir: Unable to activate SSL mode
FTP server reports 150 Opening ASCII mode data connection for file list in c:\php-5.2.1\test.php on
line 3
Warning: scandir(): (errno 11): Resource temporarily unavailable in c:\php-5.2.1\test.php on line 3

[ftp server log]
Apr 07 20:51:36 mod_tls/2.0.7[39797]: TLS/TLS-C requested, starting TLS handshake
Apr 07 20:51:38 mod_tls/2.0.7[39797]: TLSv1/SSLv3 connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)
Apr 07 20:51:38 mod_tls/2.0.7[39797]: Protection set to Private
Apr 07 20:51:38 mod_tls/2.0.7[39797]: starting TLS negotiation on data connection
Apr 07 20:51:38 mod_tls/2.0.7[39797]: unable to accept TLS connection: received EOF that violates
protocol
Apr 07 20:51:38 mod_tls/2.0.7[39797]: unable to open data connection: TLS negotiation failed


*** TEST 2 ***
[cli output]
c:\php-5.2.1>php test.php
Warning: file_get_contents(): SSL: fatal protocol error in c:\php-5.2.1\test.php on line 3
cd \
cd Windows
explorer.exe
pause

[ftp server log]
Apr 07 20:55:48 mod_tls/2.0.7[39867]: TLS/TLS-C requested, starting TLS handshake
Apr 07 20:55:50 mod_tls/2.0.7[39867]: TLSv1/SSLv3 connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)
Apr 07 20:55:50 mod_tls/2.0.7[39867]: Protection set to Private
Apr 07 20:55:50 mod_tls/2.0.7[39867]: starting TLS negotiation on data connection
Apr 07 20:55:51 mod_tls/2.0.7[39867]: TLSv1/SSLv3 data connection accepted, using cipher
DHE-RSA-AES256-SHA (256 bits)
Apr 07 20:55:51 mod_tls/2.0.7[39867]: unexpected OpenSSL error, disconnecting


*** TEST 3 ***
[cli output]
c:\php-5.1.4>php test.php
Warning: ftp_login(): SSL/TLS handshake failed in c:\php-5.1.4\test.php on line 4
Warning: ftp_login(): AUTH TLS successful in c:\php-5.1.4\test.php on line 4
bool(false)

[ftp server log]
Apr 08 04:06:50 mod_tls/2.0.7[43479]: TLS/TLS-C requested, starting TLS handshake
Apr 08 04:06:52 mod_tls/2.0.7[43479]: unable to accept TLS connection:
  (1) error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
Apr 08 04:06:52 mod_tls/2.0.7[43479]: TLS/TLS-C negotiation failed on control channel



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=41021&edit=1


Thread (5 messages)

« previous php.bugs (#202524) next »