|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31971 [PATCH] ftp_login fails on messsage from FTP+SSL server (234 Enabling SSL)
Submitted: 2005-02-14 16:19 UTC Modified: 2005-11-05 23:03 UTC
From: frantisek at augusztin dot com Assigned: iliaa (profile)
Status: Closed Package: FTP related
PHP Version: 5CVS, 4CVS (2005-05-18) OS: Linux (Fedora Core 3)
Private report: No CVE-ID: None
 [2005-02-14 16:19 UTC] frantisek at augusztin dot com
PHP returns following error when connecting using example code:
Warning: ftp_login() : Enabling SSL in /var/www/html/test.php on line 3

Using FTP client the following messages are displayed in the log window of the client :

*** Connecting to 'XXX.XXX.XXX.XXX:21'...
220 Service Ready for new User
234 Enabling SSL

FTP clearly fails on this messsage. But i don't understand why, because i found in source code, that 234 is not an error, but a valid result code for this operation.
FTP System type is "215 NETWARE  Type : L8"

Reproduce code:
$connection = ftp_ssl_connect("server",21);
$login = ftp_login($connection, "name","password");

Expected result:
No warning message and successfull connection to FTP server.

Actual result:
Warning: ftp_login() : Enabling SSL in /var/www/html/test.php on line 3


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-17 13:03 UTC] frantisek at augusztin dot com
Nope, it doesn't work. Same error as in first submission. It doesn't read any data after enabling SSL. As i said, enabling
special handling of non-conforming SSL servers using this line after ctx variable initialization in both control and data connection helps :

 [2005-10-26 16:07 UTC]
Can you please provide a patch in unified format.
 [2005-11-02 13:30 UTC] frantisek at augusztin dot com
Patch for PHP 5.0 CVS :

--- ext/ftp/ftp.c       17 Mar 2005 17:16:49 -0000
+++ ext/ftp/ftp.c       2 Nov 2005 12:22:31 -0000
@@ -281,6 +281,8 @@
                                return 0;

+                       SSL_CTX_set_options(ctx,SSL_OP_ALL);
                        ftp->ssl_handle = SSL_new(ctx);
                        if (ftp->ssl_handle == NULL) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to create the SSL handle");
@@ -1513,6 +1515,8 @@
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_accept: failed to create the SSL context");
                        return 0;
+               SSL_CTX_set_options(ctx,SSL_OP_ALL);

                data->ssl_handle = SSL_new(ctx);
                if (data->ssl_handle == NULL) {
 [2005-11-05 23:03 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 20:01:32 2024 UTC