Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIdFTP fails on Active mode transfer connection with vsFTPd #300

Closed
rlebeau opened this issue May 15, 2020 · 0 comments · Fixed by #301
Closed

TIdFTP fails on Active mode transfer connection with vsFTPd #300

rlebeau opened this issue May 15, 2020 · 0 comments · Fixed by #301
Assignees
Labels
Element: FTP Issues related to FTP handling, TIdFTP and TIdFTPServer, etc Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc Status: Fixed Issue has been fixed, no further work needed Type: Bug Issue is a bug in existing code

Comments

@rlebeau
Copy link
Member

rlebeau commented May 15, 2020

A user reported on StackOverflow that TIdFTP is not accepting an Active mode file transfer from vsFTPd.

According to the below Wireshark capture, vsFTPd is creating the transfer connection BEFORE sending a response to the RETR command:

Pyjg1

The user also tested with ICS and was able to perform the same transfer OK:

ieIwm

ICS's TFtpClient allows that connection before receiving the RETR response. But Indy's TIdFTP waits for the RETR response to arrive before it will then accept the transfer connection (this also applies to STOR/STOU/APPE requests, too), due to its use of TIdTCPConnection.SendCmd().

Re-reading RFC 959, it says the following:

The passive data transfer process (this may be a user-DTP or a second server-DTP) shall "listen" on the data port prior to sending a transfer request command. The FTP request command determines the direction of the data transfer. The server, upon receiving the transfer request, will initiate the data connection to the port. When the connection is established, the data transfer begins between DTP's, and the server-PI sends a confirming reply to the user-PI.

ICS is asynchronous, so this situation is not a big deal for it to handle. But Indy uses blocking sockets, so TIdFTP will have to be updated to account for this situation, likely by monitoring both command and transfer ports simultaneously so it can act accordingly regardless of the order in which the transfer connection and the command response arrive in.

@rlebeau rlebeau added Type: Bug Issue is a bug in existing code Element: FTP Issues related to FTP handling, TIdFTP and TIdFTPServer, etc Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc labels May 15, 2020
@rlebeau rlebeau self-assigned this May 15, 2020
@rlebeau rlebeau linked a pull request May 16, 2020 that will close this issue
@rlebeau rlebeau added the Status: Fixed Issue has been fixed, no further work needed label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Element: FTP Issues related to FTP handling, TIdFTP and TIdFTPServer, etc Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc Status: Fixed Issue has been fixed, no further work needed Type: Bug Issue is a bug in existing code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant