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

Inconsistent EPSV return message format. #69

Closed
p4l1ly opened this issue Feb 5, 2018 · 11 comments
Closed

Inconsistent EPSV return message format. #69

p4l1ly opened this issue Feb 5, 2018 · 11 comments

Comments

@p4l1ly
Copy link

p4l1ly commented Feb 5, 2018

Hi, you cannot rely on this format https://github.com/aio-libs/aioftp/blob/master/aioftp/client.py#L942

In my case I've got ' Entering Extended Passive Mode (|||50006|).' and the period causes ValueError.

@pohmelie
Copy link
Collaborator

pohmelie commented Feb 5, 2018

As RFC2428 said:

The text returned in response to the EPSV command MUST be:
<text indicating server is entering extended passive mode> (<d><d><d><tcp-port><d>)

So, the format is strict and this server do not respect it. I don't know good enough solution for this right now. Do you have any ideas?

@rsichnyi
Copy link
Contributor

rsichnyi commented Feb 5, 2018

@p4l1ly the message should be Entering Extended Passive Mode (|||50006|) (no . in the end)

@pohmelie
Copy link
Collaborator

pohmelie commented Feb 5, 2018

@rsichny I know. AFAIR the problem is not with aioftp server, but with some third server. Since, aioftp do not add dot at the end of message. https://github.com/aio-libs/aioftp/blob/master/aioftp/server.py#L474-L486

@pohmelie
Copy link
Collaborator

pohmelie commented Feb 5, 2018

@p4l1ly
What server do you use?

@p4l1ly
Copy link
Author

p4l1ly commented Feb 7, 2018

@pohmelie
It says it is Serv-U 15.1.3.3

@p4l1ly
Copy link
Author

p4l1ly commented Feb 7, 2018

Yeah, it definitely looks like the server does not respect the standard. However, you might want to consider parsing the messages the same way as ftplib to support more servers.

@pohmelie
Copy link
Collaborator

pohmelie commented Feb 7, 2018

@p4l1ly
Actually, cpython ftplib parsing code is not accurate:

bpython version 0.16 on top of Python 3.6.2 /home/broomrider/.pyenv/versions/3.6.2-kron/envs/packaging/bin/python
>>> import ftplib
>>> ftplib.parse229("229 foo bar ha-ha (|||666|)", ["localhost"])
('localhost', 666)
>>> ftplib.parse229("229 foo bar (ha-ha) (|||666|)", ["localhost"])
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    ftplib.parse229("229 foo bar (ha-ha) (|||666|)", ["localhost"])
  File "/home/broomrider/.pyenv/versions/3.6.2-kron/lib/python3.6/ftplib.py", line 870, in parse229
    raise error_proto(resp)
ftplib.error_proto: 229 foo bar (ha-ha) (|||666|)
>>>

More to say, as RFC said:

The delimiter character MUST be one of the ASCII
   characters in range 33-126 inclusive.

So, the ( or ) can be used. But yes, I got your idea of more flexible parsing. Need some time to think about.

@NickG123
Copy link

I have run into the same issue with vsFTPd 2.2.2. Are there any plans to add leniency here?

Thanks,
Nick

@pohmelie
Copy link
Collaborator

@NickG123
This is fixed already, but not released on pypi. You can use upstream version from github, or wait for couple of weeks, when I will resolve other issues and make new release.

@NickG123
Copy link

Hi @pohmelie,
I missed that commit, apologies.
However, I guess I am running into a very similar, but not exactly the same error.
The place I am running into a problem is on this line
If you want me to open a separate issue, let me know.

@pohmelie
Copy link
Collaborator

@NickG123
Try upstream version at first. If error is present, than create new issue.

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

4 participants