diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-21 11:04:31 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-21 11:04:31 +0000 |
commit | 40f62a8c3de7f9438c2137d181dde525b40a88c3 (patch) | |
tree | 30f577eb1bb57bbbc5d61c1d3533a1ca1f598eec | |
parent | 3e7ef7ead43b4b43efc92c2923fa8ed68bc9f2bd (diff) | |
download | busybox-w32-40f62a8c3de7f9438c2137d181dde525b40a88c3.tar.gz busybox-w32-40f62a8c3de7f9438c2137d181dde525b40a88c3.tar.bz2 busybox-w32-40f62a8c3de7f9438c2137d181dde525b40a88c3.zip |
wget: fix ftp PASV mode ("numeric" check was too strict)
-rw-r--r-- | networking/wget.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/networking/wget.c b/networking/wget.c index 69cabfc7f..abc011c7d 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -414,9 +414,11 @@ int wget_main(int argc, char **argv) | |||
414 | pasv_error: | 414 | pasv_error: |
415 | bb_error_msg_and_die("bad response to %s: %s", "PASV", buf); | 415 | bb_error_msg_and_die("bad response to %s: %s", "PASV", buf); |
416 | } | 416 | } |
417 | // Response is "227 garbageN1,N2,N3,N4,P1,P2 | 417 | // Response is "227 garbageN1,N2,N3,N4,P1,P2[)] |
418 | // Server's IP is N1.N2.N3.N4 (we ignore it) | 418 | // Server's IP is N1.N2.N3.N4 (we ignore it) |
419 | // Server's port for data connection is P1*256+P2 | 419 | // Server's port for data connection is P1*256+P2 |
420 | s = strrchr(buf, ')'); | ||
421 | if (s && !s[1]) s[0] = '\0'; | ||
420 | s = strrchr(buf, ','); | 422 | s = strrchr(buf, ','); |
421 | if (!s) goto pasv_error; | 423 | if (!s) goto pasv_error; |
422 | port = xatol_range(s+1, 0, 255); | 424 | port = xatol_range(s+1, 0, 255); |
@@ -608,13 +610,13 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
608 | return NULL; | 610 | return NULL; |
609 | 611 | ||
610 | /* see if we are at the end of the headers */ | 612 | /* see if we are at the end of the headers */ |
611 | for (s = buf ; *s == '\r' ; ++s) | 613 | for (s = buf; *s == '\r'; ++s) |
612 | ; | 614 | ; |
613 | if (s[0] == '\n') | 615 | if (s[0] == '\n') |
614 | return NULL; | 616 | return NULL; |
615 | 617 | ||
616 | /* convert the header name to lower case */ | 618 | /* convert the header name to lower case */ |
617 | for (s = buf ; isalnum(*s) || *s == '-' ; ++s) | 619 | for (s = buf; isalnum(*s) || *s == '-'; ++s) |
618 | *s = tolower(*s); | 620 | *s = tolower(*s); |
619 | 621 | ||
620 | /* verify we are at the end of the header name */ | 622 | /* verify we are at the end of the header name */ |
@@ -622,7 +624,7 @@ static char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
622 | bb_error_msg_and_die("bad header line: %s", buf); | 624 | bb_error_msg_and_die("bad header line: %s", buf); |
623 | 625 | ||
624 | /* locate the start of the header value */ | 626 | /* locate the start of the header value */ |
625 | for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) | 627 | for (*s++ = '\0'; *s == ' ' || *s == '\t'; ++s) |
626 | ; | 628 | ; |
627 | hdrval = s; | 629 | hdrval = s; |
628 | 630 | ||