summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorshin <shin@FreeBSD.org>2000-02-18 07:02:48 +0000
committershin <shin@FreeBSD.org>2000-02-18 07:02:48 +0000
commit0dc6c76d540c5048b41f8b402837e6e82ee3dc61 (patch)
tree5ca667417a234fd9d5e036e936dfc4cb056ea07c /usr.bin/ftp
parent6362c530d0432e0cf17d6da4319fab7ea8091122 (diff)
downloadFreeBSD-src-0dc6c76d540c5048b41f8b402837e6e82ee3dc61.zip
FreeBSD-src-0dc6c76d540c5048b41f8b402837e6e82ee3dc61.tar.gz
Don't try EPSV once it failed.
Specified by: Andrey A. Chernov" <ache@nagual.pp.ru> Approved by: jkh
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/ftp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c
index cfdfda8..ddf41e1 100644
--- a/usr.bin/ftp/ftp.c
+++ b/usr.bin/ftp/ftp.c
@@ -1174,6 +1174,8 @@ initconn()
#endif
if (passivemode) {
+ static int try_epsv = 1;
+
data_addr = myctladdr;
data = socket(data_addr.su_family, SOCK_STREAM, 0);
if (data < 0) {
@@ -1205,13 +1207,18 @@ initconn()
warn("setsockopt (ignored)");
switch (data_addr.su_family) {
case AF_INET:
- result = command(pasvcmd = "EPSV");
- if (code / 10 == 22 && code != 229) {
- puts("wrong server: return code must be 229");
+ if (try_epsv != 0) {
+ result = command(pasvcmd = "EPSV");
+ if (code / 10 == 22 && code != 229) {
+ puts("wrong server: return code must be 229");
+ result = COMPLETE + 1;
+ }
+ } else
result = COMPLETE + 1;
- }
- if (result != COMPLETE)
+ if (result != COMPLETE) {
+ try_epsv = 0;
result = command(pasvcmd = "PASV");
+ }
break;
#ifdef INET6
case AF_INET6:
OpenPOWER on IntegriCloud