Closed Bug 130299 Opened 22 years ago Closed 22 years ago

confused by , in PASV response message

Categories

(Core Graveyard :: Networking: FTP, defect, P3)

x86
Windows 2000
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.0

People

(Reporter: asg, Assigned: bbaetz)

References

()

Details

(Keywords: regression, testcase)

Attachments

(1 file, 1 obsolete file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.9) Gecko/20020311
BuildID:    2002031104

mozilla does not except server response codes that are different from:
"227 Entering Passive Mode"
But as described in rfc 1123 the client should only trigger on the three digits
response code and not on the text behind it, because the text is not well
standardized.

Reproducible: Always
Steps to Reproduce:
1. open ftp://ftp.ftpproxy.org
2.
3.

Actual Results:  mozilla is unable to connect to the server.
I get an error : "ok, entering passive mode (....) " but i don't get the
directory list 

-> New
Status: UNCONFIRMED → NEW
Ever confirmed: true
No, thats not the issue here. Possibly similar to bug 128927. I'll check if that
patch helps me, in a bit.
Priority: -- → P3
Target Milestone: --- → mozilla1.0
OK, its not the code, or the CRLF in a separate packet. The problem is the comma
in the message.

For PASV, we have to parse the returned value, and there appears to be code in
there to look for both (xxx,xxx,xxx,xxx,ppp,ppp) form, as well as the form
without brackets. So when we see the , in "ok, entering passive mode", we die
because "ok" isn't a valid number.

We should probably just try with brackets, then without. As with much of ftp,
theres no standard for this, unfortunately.
Status: NEW → ASSIGNED
Summary: FTP PASV responses code → confused by , in PASV response message
Well... I've fixed this probelm, and will attach a patch. This still doesn't fix
the problem with this server though.

The problem is that RETR <directory> returns a 0 length file. ns4 works because
it tries to LIST names ending with a / first. ftp://ftp.ftpproxy.org/beta
(without the trailing /) fails. This is a server bug, I think.

Anyway, patch for this issue coming up.
Attached patch patch (obsolete) — Splinter Review
We first look for numbers in brackets, then try without.

To verify that this fixes the problem, observe that with the patch this doesn't
hang, or try to download ftp://ftp.ftpproxy.org/ftpproxy-1.1.5.tgz directly (or
any other file, not directory.

Tested on localhost, ftp.m.o, and ftp.ftpproxy.org
it seems like you shouldn't have to call PR_sscanf in two different places.  if
you can somehow determine the location of the first number, then you can just
call PR_sscanf from there.  how about searching backwards instead of forwards?

i.e., search backwards for the 5th comma, and then search backward until you're
no longer seeing ASCII digits, then call PR_sscanf.  wouldn't that be simpler? 
or is  it likely that servers will send random text after the "ww,xx,yy,zz,aa,bb"?
I don't want to be tricked by:

2xx PASV channel number 1, go ahead (a,b,c,d,x,y)

or something. Robustness ;)
Comment on attachment 74597 [details] [diff] [review]
patch

+	 if (*ptr) {
+	     ++ptr;
+	     fields = PR_sscanf(ptr, 

You should probably check for null before calling PR_sscanf. (in both cases)

Add an assertion if fields is <6 in the second case.  Maybe it will help us
track down another problem.

fix that and r=dougt
Attachment #74597 - Flags: review+
ptr can't be null - we get it from a string just above.

*ptr could be null, but that means we have an empty string, which then won't
match in scanf, so thats ok

Added:

NS_ASSERTION(fields == 6, "Can't parse PASV response"); just before the if at
the end of the patch.
*** Bug 133146 has been marked as a duplicate of this bug. ***
Attached patch v2Splinter Review
added the assertion in
Attachment #74597 - Attachment is obsolete: true
Comment on attachment 75886 [details] [diff] [review]
v2

sr=darin
Attachment #75886 - Flags: superreview+
i sr='d the patch because it looks solid, but in response to comment #7,

  "2xx PASV channel number 1, go ahead (a,b,c,d,x,y)"

would not get fouled up if you searched backwards for the 5th comma, and then
searched backward until you're no longer on an ASCII digit, and then called
PR_sscanf.  it just seems like a much simpler algorithm... but whatever :-/
but then I need to do isnum... scanf is designed for this, and I prefer clarity,
given the non-perf critical nature of this code.
Comment on attachment 75886 [details] [diff] [review]
v2

r=gagan
make sure this gets enough testing done too!
Attachment #75886 - Flags: review+
Comment on attachment 75886 [details] [diff] [review]
v2

a=asa (on behalf of drivers) for checkin to the 1.0 trunk
Attachment #75886 - Flags: approval+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
reporter: is this working for you? Try RC1.
Yes. is working fine.

Thanks
VERIFIED: per reporter.
Status: RESOLVED → VERIFIED
Keywords: testcase
In the past, this site had stopped working, it would connect, then display a
blank page. I did not file a bug, because when I tested their server by hand, it
would close the connection immediately after connecting.

However, the site is now working via ftp from DOS and Solaris line command
clients, and is not working via Mozilla 1.3a nor from a recent, patch-test daily
build that Darin gave me.

I'm not sure what to do, so I'm starting by reopening and keyword +regression.
If this is a new problem w/ a new bug, I'll move.
Status: VERIFIED → REOPENED
Keywords: regression
Resolution: FIXED → ---
We found the problem.


It was yet not mozilla bug, but a ftp.server bug.


The ftp.server did not reply correctly on a 'GET <DIRECTORY>' request.


The problem is fixed and I think we can re-close the ticket.




Thanks


Andreas


RESOLVED, WFM: Chimera 0.6 + Mozilla 1.3b/Mach-O.
Status: REOPENED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: