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