Current time: 04-25-2024, 11:08 PM Hello There, Guest! (LoginRegister)


Post Reply 
net2ftp ftp_login error (fedora 7)
Author Message
macbishop Offline
Junior Member
*

Posts: 68
Joined: Feb 2007
Reputation: 7
Post: #11
RE: net2ftp ftp_login error (fedora 7)
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
11-03-2007 08:14 PM
Find all posts by this user Quote this message in a reply
raphael Offline
Member
***

Posts: 474
Joined: Apr 2007
Reputation: 8
Post: #12
RE: net2ftp ftp_login error (fedora 7)
I don't like workarounds, if you want this to work go and help the php devs and fix it there.
11-04-2007 04:11 AM
Visit this user's website Find all posts by this user Quote this message in a reply
graywolf Offline
Junior Member
*

Posts: 43
Joined: Sep 2007
Reputation: 1
Post: #13
RE: net2ftp ftp_login error (fedora 7)
I posted the bug to bugs.php.net and posted the code on net2ftp.

Can i suggest a optional patch include in the dists?
11-05-2007 06:38 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)