#10287 closed Bug report (rejected)
Wrong return code for CDUP command
Reported by: | Sascha Pfalz | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | FileZilla Server |
Keywords: | CDUP returncode | Cc: | sascha.pfalz@… |
Component version: | Operating system type: | Windows | |
Operating system version: | Window 7 Professional |
Description
Hi,
according to RFC 959 a FTP Server should return the same returncode for the CDUP command the CWD command returns.
In case of Filezilla Server (0.9.49 beta) however, this is not true:
(000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> CWD /TEST (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> '''250''' CWD successful. "/TEST" is current directory. (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> PWD (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> 257 "/TEST" is current directory. (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> CDUP (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> '''200''' CDUP successful. "/" is current directory. (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> PWD (000008)06.03.2015 08:06:44 - pantest (127.0.0.1)> 257 "/" is current directory.
As can be seen CDUP returns 200 while CWD returns 250.
This breaks i.e. the PHP function "ftp_cdup()" as it expects the 250 return code for successful operation.
I've also tested against vSFTPd, that Server returns 250 as expected.
Change History (5)
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
Resolution: | → rejected |
---|---|
Status: | new → closed |
comment:3 by , 10 years ago
Hi,
if you scroll down to page 62 on that RFC you will find:
...
REPLY CODES
The CDUP command is a special case of CWD, and is included to
simplify the implementation of programs for transferring directory
trees between operating systems having different syntaxes for
naming the parent directory. The reply codes for CDUP be
identical to the reply codes of CWD.
...
But anyway we will integrate a workaround for Filezilla, as all other FTP server behave differently (they all send 250). Thanks for listening.
comment:4 by , 10 years ago
Lovely, another inconsistency in the standard. Both 200 and 250 are both right and wrong at the same time.
Out of interest, why do you parse the second and possibly third digit of the reply code? I'm not aware of any FTP command where these digits have any semantic meaning, especially not in the success case.
comment:5 by , 10 years ago
Hi,
well I do not parse it, but PHP does! I've checked the ext/ftp/ftp.c Code from PHP sources, and there you'll find:
if (!ftp_getresp(ftp) || ftp->resp != 250) { return 0; }
And that's the problem...if I perform the PHP function "ftp_cdup()" against Filezilla, I've get an error (FALSE) from that call, as they implicitly check for code 250...maybe I should open a feature request to the PHP devs and ask to check for both 200 and 250 codes to return TRUE...
According to RFC 959, CDUP uses reply code 200: https://tools.ietf.org/html/rfc959#page-50