diff options
author | ume <ume@FreeBSD.org> | 2000-07-10 08:41:25 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2000-07-10 08:41:25 +0000 |
commit | 4f24653720b28a2f9804fc12b421e0c12fa87ce5 (patch) | |
tree | f2209f21059a27cdc2fb07b3c6cede567d7c5a26 /lib/libfetch | |
parent | 7a2b8e6857702022e43aae047edb6e88c22226af (diff) | |
download | FreeBSD-src-4f24653720b28a2f9804fc12b421e0c12fa87ce5.zip FreeBSD-src-4f24653720b28a2f9804fc12b421e0c12fa87ce5.tar.gz |
Make EPSV work again. Separate parsing code of 229 replies from
the code for 227 and 228.
Submitted by: des
Diffstat (limited to 'lib/libfetch')
-rw-r--r-- | lib/libfetch/ftp.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c index bb34aed..be1515b 100644 --- a/lib/libfetch/ftp.c +++ b/lib/libfetch/ftp.c @@ -300,15 +300,15 @@ _ftp_transfer(int cd, char *oper, char *file, * is IMHO the one and only weak point in the FTP protocol. */ ln = last_reply; - for (p = ln + 3; *p && !isdigit(*p); p++) - /* nothing */ ; - if (!*p) { - e = 999; - goto ouch; - } - switch (e) { + switch (e) { case FTP_PASSIVE_MODE: case FTP_LPASSIVE_MODE: + for (p = ln + 3; *p && !isdigit(*p); p++) + /* nothing */ ; + if (!*p) { + e = 999; + goto ouch; + } l = (e == FTP_PASSIVE_MODE ? 6 : 21); for (i = 0; *p && i < l; i++, p++) addr[i] = strtol(p, &p, 10); @@ -318,6 +318,13 @@ _ftp_transfer(int cd, char *oper, char *file, } break; case FTP_EPASSIVE_MODE: + for (p = ln + 3; *p && *p != '('; p++) + /* nothing */ ; + if (!*p) { + e = 999; + goto ouch; + } + ++p; if (sscanf(p, "%c%c%c%d%c", &addr[0], &addr[1], &addr[2], &port, &addr[3]) != 5 || addr[0] != addr[1] || |