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

PRET (PRE Transfer) command #684

Closed
cyberduck opened this issue Aug 17, 2006 · 8 comments
Closed

PRET (PRE Transfer) command #684

cyberduck opened this issue Aug 17, 2006 · 8 comments
Assignees
Labels
Milestone

Comments

@cyberduck
Copy link
Collaborator

anonymous created the issue

Some servers, for example drftpd, requires PRET support when connecting in passive mode. It's basically a command that is sent before transfers to inform the server that the client is about to do something.

More info: http://www.drftpd.org/index.php/Distributed_PASV#Solution:_PRET_.28PRE_Transfer.29_command


Attachments

@cyberduck
Copy link
Collaborator Author

398449a commented

I made a little patch in order to make Cyberduck compatible with PRET enabled ftps, it just send a "PRET command" command before any of the commands specified in the PRET specifications (http://drftpd.org/index.php/PRET_Specifications).
The command is sent without checking for any reply, if the server doesn't support the feature, then an error message is sent to Cyberduck and nothing happens.
Let me know if something is wrong, i'm not an experienced coder but the patch is really small.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Thanks for the patch. I have some notes on this:

  • Should only be sent if the response to FEAT contains PRET.
  • The client is only required to send a PRET command before PASV

@cyberduck
Copy link
Collaborator Author

398449a commented

Replying to [comment:5 dkocher]:

a) yes that's what the specs says, but I've seen some servers not spitting out the PRET inside the FEAT command, I think it's better trying to issue a PRET command anyway, in the worst case, we just get a "not implemented" error, and the connection goes on. Also I saw you have a nice "features()" function, but I didn't understand when and if it's called.

b) from the specs: "Must be sent before the PASV and ONLY the PASV command. PRET is unneccessary to be sent before any other command, although it can help enable a security feature on clients using Active transfers." so, leaving PRET enabled also for Active connections is not a bad thing. Anyway, adding a check to see if the connection is passive and, only in that case, issue the PRET command is just a matter of add some "if", so if you think it's better, I can add this check.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Thanks for comment. I have commited 9f2ecf9 which makes use of PRET if it is listed in response to FEAT. Needs testing as I don't have access to a drftpd server.

@cyberduck
Copy link
Collaborator Author

398449a commented

an error has been introduced, the server I use for test, allows the use of the FEAT command only to authenticated users:

220 DrFTPD 2.0.2 http://drftpd.org
FEAT
530 Not logged in.
220 DrFTPD 2.0.2 http://drftpd.org
FEAT
530 Not logged in.

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Replying to [comment:8 neothematrix]:

> 220 DrFTPD 2.0.2 http://drftpd.org
> FEAT
> 530 Not logged in.
> 220 DrFTPD 2.0.2 http://drftpd.org
> FEAT
> 530 Not logged in.

Fixed in b5f5e4b.

@cyberduck
Copy link
Collaborator Author

398449a commented

ok, working perfectly now, just a note, now the FEAT command is sent before ANY createDataSocket, not just the first one
you didn't save the "features" variable correctly, I wrote a fix :) wow I like patching eheh
btw, do you have some additional documentation? I'd like to add support for external IP detection and the selection of a range of ports for the PORT command (in order to make PORT command works behind firewalls)

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Replying to [comment:10 neothematrix]:

ok, working perfectly now, just a note, now the FEAT command is sent before ANY createDataSocket, not just the first one
you didn't save the "features" variable correctly, I wrote a fix :) wow I like patching eheh
btw, do you have some additional documentation? I'd like to add support for external IP detection and the selection of a range of ports for the PORT command (in order to make PORT command works behind firewalls)

Thanks for watching :) Fixed in 0268892. I don't have any more documentation, but you may find at [enterprisedt.net].

@iterate-ch iterate-ch locked as resolved and limited conversation to collaborators Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants