Bug 306191
| Summary: | FTP client does not restore binary mode after DIR command | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Thomas L. Shinnick <tshinnic> |
| Component: | ftp | Assignee: | Marcela Mašláňová <mmaslano> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 7 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | ftp-0.17-44.fc9 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2007-12-12 10:05:03 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
An associate remarked that the FTP client "couldn't know the TYPE I was needed as you used the QUOTE command". That reminded me to add a trace showing what would happen when the client 'knew' it needed to reinstate the "TYPE I". 230 Access granted to Budgie user testthis ---> SYST 215 UNIX Type: L8 Remote system type is UNIX. Using binary mode to transfer files. ftp> binary ---> TYPE I 200 Type set to I ftp> dir ---> TYPE A 200 Type set to A ftp: setsockopt (ignored): Permission denied ---> PASV 227 Entering Passive Mode (192,168,130,129,194,7). ---> LIST 150 Opening ASCII mode data connection for file list drwxrws--- 2 budgftp budgftp 4096 Sep 24 12:28 download -rwx------ 1 budgftp budgftp 69 Jul 8 16:20 testfile1 drwxrws--- 3 budgftp budgftp 4096 Sep 25 18:36 upload 226 Transfer complete ftp> quote size testfile1 ---> size testfile1 550 SIZE not allowed in ASCII mode ftp> get testfile1 local: testfile1 remote: testfile1 ---> TYPE I 200 Type set to I ftp: setsockopt (ignored): Permission denied ---> PASV 227 Entering Passive Mode (192,168,130,129,163,160). ---> RETR testfile1 150 Opening BINARY mode data connection for testfile1 (69 bytes) 226 Transfer complete 69 bytes received in 0.0262 secs (2.6 Kbytes/sec) ftp> quote size testfile1 ---> size testfile1 213 69 Note the "TYPE I" before the file transfer is started. The client 'knows' it needs to do this again, having previously undone it. It didn't 'know' it needed to do this before the 'QUOTE'd command. My opinion is it shouldn't be guessing 'when' at all. Do you have some preferable solution? I can simply switch on TYPE_I in quote command. Fixed in rawhide. |
Description of problem: The FTP client in package ftp-0.17-41.fc7 switches to ASCII mode before submitting a DIR command, in order to correctly receive the listing output, but then does not restore the previously user-requested BINARY mode. Some FTP servers are sensitive to current binary/ascii mode. In particular some have declined to handle SIZE commands in ASCII mode, as the requirement to scan line endings throughout very large files would nearly equate to a DOS attack. Thus some FTP servers require the session to be in BINARY mode before they will service a SIZE command. In the current client, the sequence of commands BINARY DIR QUOTE SIZE foo.bar will fail with a server-generate error message, such as "550 SIZE not allowed in ASCII mode". The same sequence of commands will not fail if the WinXPSP2 command line FTP client is used. Version-Release number of selected component (if applicable): ftp-0.17-41.fc7 How reproducible: Every time when connected to a server requiring binary mode SIZE commands and the above command sequence is entered. Steps to Reproduce: 1. ftp ftp.proftpd.org 2. <login as anonymous> 3. enter binary command 4. enter command "quote size README.MIRRORS" 5. enter dir command 6. enter command "quote size README.MIRRORS" Actual results: The second quote size command is responded to with 550 SIZE not allowed in ASCII mode Expected results: Both the first and second commands should receive output 213 451 Additional info: I ran both the Linux and Windows ftp client programs with the "-d" option, showing the commands submitted to the FTP server. Here is the output from each: Connected to ftp.proftpd.org (78.47.206.250). 220 ProFTPD 1.3.1rc2 Server (ProFTPD.org Project) [78.47.206.250] Name (ftp.proftpd.org:tom): anonymous ---> USER anonymous 331 Anonymous login ok, send your complete email address as your password Password: ---> PASS XXXX 230 Anonymous access granted, restrictions apply ---> SYST 215 UNIX Type: L8 Remote system type is UNIX. Using binary mode to transfer files. ftp> binary ---> TYPE I 200 Type set to I ftp> quote size README.MIRRORS ---> size README.MIRRORS 213 451 ftp> dir ---> TYPE A 200 Type set to A ftp: setsockopt (ignored): Permission denied ---> PASV 227 Entering Passive Mode (78,47,206,250,134,116). ---> LIST 150 Opening ASCII mode data connection for file list -r-------- 1 ftp ftp 11 Sep 25 22:10 MIRMON.PROBE -r-------- 1 ftp ftp 451 Jul 1 2005 README.MIRRORS dr-x------ 3 ftp ftp 18 Jul 1 2005 contrib dr-x------ 3 ftp ftp 19 Jul 1 2005 devel dr-x------ 4 ftp ftp 34 Nov 19 2002 distrib dr-x------ 4 ftp ftp 34 Jul 1 2005 historic 226 Transfer complete ftp> quote size README.MIRRORS ---> size README.MIRRORS 550 SIZE not allowed in ASCII mode Connected to rsync.proftpd.de. 220 ProFTPD 1.3.1rc2 Server (ProFTPD.org Project) [78.47.206.250] User (rsync.proftpd.de:(none)): anonymous ---> USER anonymous 331 Anonymous login ok, send your complete email address as your password Password: ---> PASS tshinnic 230 Anonymous access granted, restrictions apply ftp> binary ---> TYPE I 200 Type set to I ftp> quote size README.MIRRORS ---> size README.MIRRORS 213 451 ftp> dir ---> TYPE A ---> PORT 192,168,0,70,11,165 200 PORT command successful ---> LIST 150 Opening ASCII mode data connection for file list -r-------- 1 ftp ftp 11 Sep 25 22:10 MIRMON.PROBE -r-------- 1 ftp ftp 451 Jul 1 2005 README.MIRRORS dr-x------ 3 ftp ftp 18 Jul 1 2005 contrib dr-x------ 3 ftp ftp 19 Jul 1 2005 devel dr-x------ 4 ftp ftp 34 Nov 19 2002 distrib dr-x------ 4 ftp ftp 34 Jul 1 2005 historic 226 Transfer complete ftp: 395 bytes received in 0.02Seconds 24.69Kbytes/sec. ---> TYPE I ftp> quote size README.MIRRORS ---> size README.MIRRORS 213 451 Note that the Windows FTP (second trace) follows the DIR with another "TYPE I" to restore the BINARY mode requested by the user.