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

PASV implementation is incompatible with ncftp: Cannot parse PASV response: listen socket created #142

Open
eLvErDe opened this issue Oct 8, 2021 · 4 comments

Comments

@eLvErDe
Copy link

eLvErDe commented Oct 8, 2021

Hello,

It seems aioftp server cannot communicate with NCFTP, here is the client transcript:

NcFTP 3.2.5 (Feb 02, 2011) by Mike Gleason (http://www.NcFTP.com/contact/).
Connecting to 10.1.1.1...                                                                                                                                                                                       
welcome
Logging in...                                                                                                                                                                                                      
normal login
'help' not implemented                                                                                                                                                                                             
Logged in to 10.1.1.1.                                                                                                                                                                                          
ncftp / > ls
Cannot parse PASV response: listen socket created

It stays stuck here, on server side I can read the following logs:

2021-10-08 21:03:51,221 DEBUG    [aioftp.server] 150 list transfer started
2021-10-08 21:03:52,222 DEBUG    [aioftp.server] 425 Can't open data connection

I dig into the issue and came up with a workaround, the issue is here:
https://github.com/aio-libs/aioftp/blob/master/aioftp/server.py#L1437

Replacing

code, info = "227", ["listen socket created"]

With

code, info = "227", []

Make ncftp client work perfectly fine.

Sadly I do not see any easy way to fix this without inheriting and copy/pasting the whole pasv method, which is kinda bad.

What do you think about this incompatibility ?

Regards, Adam.

@pohmelie
Copy link
Collaborator

pohmelie commented Oct 9, 2021

It looks like ncftp do not respect ftp (rfc959)[https://datatracker.ietf.org/doc/html/rfc959] part 4.2. Multiline responses allowed.

@eLvErDe
Copy link
Author

eLvErDe commented Oct 9, 2021

Not really surprised but would you consider a "compat" option for that ?

@eLvErDe
Copy link
Author

eLvErDe commented Oct 9, 2021

Meanwhile, I inherited from Server and copy/pasted pasv method but that's far from optimal

@pohmelie
Copy link
Collaborator

Feel free to make a PR for this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants