ispCP - Board - Support
net2ftp ftp_login error (fedora 7) - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: Usage (/forum-34.html)
+--- Thread: net2ftp ftp_login error (fedora 7) (/thread-1616.html)

Pages: 1 2


RE: net2ftp ftp_login error (fedora 7) - macbishop - 11-03-2007 08:14 PM

raphael Wrote:do you require SSL to be used in ftp? if so, it is a bug in php

Yeah is a php bug
http://bugs.php.net/bug.php?id=43118&edit=1
but isn't necessary SSL ftp to reproduce it.
The problem is ftp_login() function and the patch replaces this function.

In original filemanager/includes/filesystem.inc.php line 61
Code:
    $login_result = ftp_login($conn_id, $net2ftp_globals["username"], $net2ftp_password);
If the user make a mistake in login page, retrieve a warning message:
Code:
Warning: ftp_login() [function.ftp-login]: Login incorrect. in  /var/www/ispcp/gui/tools/filemanager/includes/filesystem.inc.php on line 56
but in some cases (php 5.2.3-1 in my case) if the data is correct return login fails due to a php bug:
Code:
Warning: ftp_login() [function.ftp-login]: AUTH not understood in /var/www/ispcp/gui/tools/filemanager/includes/filesystem.inc.php on line 61
With the patch comment filemanager/includes/filesystem.inc.php line 61 and add below:
Code:
//$login_result = ftp_login($conn_id, $net2ftp_globals["username"], $net2ftp_password);

//Custom Login code

$login_result=false;

$commands   = array("USER ". $net2ftp_globals["username"],"PASS ". $net2ftp_password);

foreach($commands as $c) {
    $ret    = ftp_raw($conn_id,$c);

    //you can write your own ftp_parse_response func that
    //use an array of string as input

    foreach($ret as $r) {

    $code    = substr(trim($r),0,3);

    if ($code == 530){ $login_result=false;}
    if ($code == 230) {$login_result=true;}
    }
}
Not more login fails due to a php bug and not more ugly php warning mistake messages


RE: net2ftp ftp_login error (fedora 7) - raphael - 11-04-2007 04:11 AM

I don't like workarounds, if you want this to work go and help the php devs and fix it there.


RE: net2ftp ftp_login error (fedora 7) - graywolf - 11-05-2007 06:38 AM

I posted the bug to bugs.php.net and posted the code on net2ftp.

Can i suggest a optional patch include in the dists?