Opened 18 years ago

Closed 15 years ago

Last modified 11 years ago

#3127 closed Bug report (outdated)

Paths without leading '/' character won't work in FTP/SFTP

Reported by: aggro80 Owned by:
Priority: normal Component: FileZilla Client
Keywords: Cc: aggro80, Alexander Schuch, Tim Kosse, gpardun
Component version: Operating system type:
Operating system version:

Description

Tested version: Filezilla 3.0.0-beta7, Windows XP

Paths without leading '/' character won't work.

I'm trying to retrieve a directory listing from a ftp server. I suspect that the listing fails because the path on the server doesn't have the leading '/' character in it. So for example if you would connect to a normal Linux server the path could be "/example-path/", but on this server the correct path is "example-path/". The PWD command returns the correct path (without leading '/') from the server so the problem is not with the return value from server. The problem is that Filezilla doesn't understand the returned path.

Every command line client on Windows and Linux I have tested work with this server. So the problem is not with the server, even it does use quite unusual directory structure.

The problem is with both FTP and SFTP.

I edited the log by replacing information with [SENSORED] tags, even the path it returns. Apologies about this, but I'm working in a company where I don't have permission to reveal any information about the systems we use, not even the paths on the server. But I hope the explanation above will give you enough information about the problem.

# FTP LOG
Response: 230 User [SENSORED] logged in.
Command: SYST
Trace: CFtpControlSocket::OnReceive()
Response: 500 Command not implemented.
Command: FEAT
Trace: CFtpControlSocket::OnReceive()
Response: 500 Unknown command: 'FEAT'
Status: Connected
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Status: Retrieving directory listing...
Trace: CFtpControlSocket::SendNextCommand(0)
Command: PWD
Trace: CFtpControlSocket::OnReceive()
Response: 257 "[SENSORED]" is current directory.
Trace: ControlSocket.cpp(557): Failed to parse returned path. caller=01284C08
Trace: CFtpControlSocket::ResetOperation(2)
Trace: CControlSocket::ResetOperation(2)
Trace: CFtpControlSocket::SendNextCommand(2)
Trace: CFtpControlSocket::ListSend(2)
Trace: CFtpControlSocket::ResetOperation(2)
Trace: CControlSocket::ResetOperation(2)
Error: Failed to retrieve directory listing

Change History (9)

comment:1 by Alexander Schuch, 18 years ago

You can mark this bug report as private/confidential so that only project developers can see it and not the public.

Do you know what FTP server this is?

comment:2 by aggro80, 18 years ago

Marking it private wouldn't help. The problem is not that I can't tell this publicly, the problem is that I can't tell this to anyone who hasn't signed several contracts about silency. The best I can do is to give you examples of similar data, which I did in the original bug report.

I know what the FTP server is, but I can't tell you that and you can't test with it. But the server is implemented according to the FTP standards (and command line ftp clients, both Windows and Linux versions work with it) so there should be no problems with that. Also the debug log shows what the server is returning, except the "path" part, which I replaced with an example "example-path/". So if Filezilla could handle correctly "example-path/" it would probably work on that server too.

comment:3 by aggro80, 18 years ago

I looked the source and found one clear bug from there. The code that has the bug is here:

src/engine/serverpath.cpp:

82 else if (path.Length() >= 3 &&

83 (path.c_str()[0] >= 'A' && path.c_str()[0] <= 'Z') 84 path.c_str()[1] == ':' && (path.c_str()[2] == '
'
(path.c_str()[0] >= 'a' && path.c_str()[0] <= 'z') &&
path.c_str()[2] == '/'))

85 m_type = DOS;

With that code CServerPath::SetPath() will think that:
"AAAA/" is a DOS path and (If length >= 3 and first letter is A-Z the whole "else if" is instantly true)
"aAAA/" is a UNIX path.

This causes the auto-detect to work incorrectly, but doesn't solve the original problem, because it happens also when UNIX-mode is forced.

But in my original problem, instead of "example-path/" it is probably better to say that "AAAA/" path doesn't work.

comment:4 by Tim Kosse, 18 years ago

Most commandline clients aren't parsing paths or directory listings, they just directly display what the server returns. FileZilla however has to parse the data from the server. For that it has to be in a known format.

In order to implement support for your server I'd need more information.

The most important being: How does your server distibguish between absolute and relative paths?

comment:5 by aggro80, 18 years ago

Ok, I submitted patch "[ 1690795 ] Fix serverpath autodetect" to fix the first problem.

comment:6 by aggro80, 18 years ago

I did figure out that the problem is not limited to the leading '/'. There are other problems also that require custom handling, a new server type must be added to Filezilla to provide support for it.

But like I said, I don't have permission to provide much info. But if you are willing to implement support for the system, I will contact the people above me if I could get a permission to provide the needed info. Please respond are you willing to do this?

I can also do some work for this (I'm a programmer also, as you might have noticed.), but I'm not familiar with Filezilla's code.

After you have replied, I think this bug report can be marked as closed. As the original problem with "Trace: ControlSocket.cpp(557): Failed to parse returned path. " is not fixed. I will open a new bug report/feature request about the new server type if you accept the idea.

comment:7 by gpardun, 17 years ago

Here is a log illustrating the problem. None of the subdirectories show up in the Remote site tree or in the Filename list. The server is a Unisys ClearPath mainframe.

Trace: ControlSocket.cpp(979): CRealControlSocket::ContinueConnect(0p23d184) m_pEngine=0p15013d0 caller=0p1590ce0
Status: Connecting to 192.168.1.10:21...
Status: Connection established, waiting for welcome message...
Trace: CFtpControlSocket::OnReceive()
Response: 220 FTP Services for ClearPath MCP: Server version 51.189.8003
Trace: CFtpControlSocket::SendNextCommand()
Command: USER gpc
Trace: CFtpControlSocket::OnReceive()
Response: 331 UserName received; please send the PassWord.
Trace: CFtpControlSocket::SendNextCommand()
Command: PASS *
Trace: CFtpControlSocket::OnReceive()
Response: 230 User GPC logged in; you may proceed.
Trace: CFtpControlSocket::SendNextCommand()
Command: SYST
Trace: CFtpControlSocket::OnReceive()
Response: 215 ClearPath LX Series FTP version 51.189.8003 (MCP version 52.150.1189)
Trace: CFtpControlSocket::SendNextCommand()
Command: FEAT
Trace: CFtpControlSocket::OnReceive()
Response: 211-Extensions supported:
Response: MDTM
Response: 211 End
Status: Connected
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Status: Retrieving directory listing...
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::ChangeDirSend()
Command: CWD /source/bankdb/
Trace: CFtpControlSocket::OnReceive()
Response: 250 The current working directory is now "/SOURCE/BANKDB".
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::ChangeDirSend()
Command: PWD
Trace: CFtpControlSocket::OnReceive()
Response: 257 "/SOURCE/BANKDB" is the current working directory.
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFtpControlSocket::ParseSubcommandResult(0)
Trace: CFtpControlSocket::ListSubcommandResult()
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Command: TYPE I
Trace: CFtpControlSocket::OnReceive()
Response: 200 The TYPE has been set to Image.
Trace: CFtpControlSocket::TransferParseResponse()
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Command: PASV
Trace: CFtpControlSocket::OnReceive()
Response: 227 Passive mode entered (192,168,1,10,128,21)
Trace: CFtpControlSocket::TransferParseResponse()
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Command: LIST
Trace: CTransferSocket::OnConnect
Trace: CFtpControlSocket::OnReceive()
Response: 150 Opening a Type ASCII Data connection for "SOURCE/BANKDB".
Trace: CFtpControlSocket::TransferParseResponse()
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Listing: d--------- 1 GPC 0 Jan 01 1000 L1
Listing: -rwx------ 1 GPC 1530 Dec 18 2003 TB
Listing: -rwx------ 1 GPC 9000 Jun 21 2001 GEN
Listing: d--------- 1 GPC 0 Jan 01 1000 LIST
Listing: -rwx------ 1 GPC 165060 Apr 02 2004 TEXT
Listing: d--------- 1 GPC 0 Jan 01 1000 CLEAN
Listing: d--------- 1 GPC 0 Jan 01 1000 DASDL
Listing: -rwxr-xr-x 1 GPC 54360 Feb 21 2007 DASDL
Listing: -rwx------ 1 GPC 1080 Aug 05 2004 TRANS
Listing: -rwx------ 1 GPC 3864 Jun 21 2001 DELETE
Listing: -rwx------ 1 GPC 924 Jan 24 2007 INVOKE
Listing: d--------- 1 GPC 0 Jan 01 1000 UPDATE
Listing: -rwx------ 1 GPC 8280 Jun 21 2001 UPDATE
Listing: d--------- 1 GPC 0 Jan 01 1000 HISTORY
Listing: -rwxrwxrwx 1 GPC 5292 Jun 21 2001 EMBEDDED
Listing: -rwx------ 1 GPC 112500 Feb 10 2004 FILEATTS
Listing: -rwx------ 1 GPC 1800 Jan 24 2007 REVERSALS
Listing: -rwx------ 1 GPC 990 Sep 05 2001 STATEMENT
Listing: -rwx------ 1 GPC 900 May 21 2003 FUNNYSTUFF
Listing: -rwx------ 1 GPC 1440 Aug 04 2004 UPDATEGLOBAL
Trace: CTransferSocket::OnClose
Trace: CTransferSocket::TransferEnd(1)
Trace: CFtpControlSocket::OnReceive()
Response: 226 Transfer complete; Data connection closed.
Trace: CFtpControlSocket::TransferParseResponse()
Trace: CFtpControlSocket::SendNextCommand()
Trace: CFtpControlSocket::TransferSend()
Trace: CFtpControlSocket::TransferEnd()
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Trace: CFtpControlSocket::ParseSubcommandResult(0)
Trace: CFtpControlSocket::ListSubcommandResult()
Trace: CFtpControlSocket::ResetOperation(0)
Trace: CControlSocket::ResetOperation(0)
Status: Directory listing successful
Trace: CRealControlSocket::OnClose()
Error: Disconnected from server
Trace: CFtpControlSocket::ResetOperation(66)
Trace: CControlSocket::ResetOperation(66)

comment:8 by Tim Kosse, 16 years ago

Component: OtherFileZilla Client

comment:9 by Tim Kosse, 15 years ago

Resolution: outdated
Status: newclosed

@aggro80: Please try the most recent version. Make sure to test all the different server types in the site manager.

@gpardun: That listing format cannot possibly be supported, it is mutually exclusive with a different, indistinguishable format.
Yours is perms, linkcount, user (GPC), size (0), month (Jan), day (01), year (1000), name (UPDATE)
A similar diferent format is perms, linkcount, user (GPC), group (0), domain (Jan), size (1000), name (1000 UPDATE)
In case of conflicting list formats it's first comes first served. You need to update to a proper server supporting the MLSD extension which uses a well standardized, unambiguous listing format.

Note: See TracTickets for help on using tickets.