summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2000-02-21 18:18:41 +0000
committerache <ache@FreeBSD.org>2000-02-21 18:18:41 +0000
commit92446000b5bac2ba7980291070f3cc67ce6c1299 (patch)
tree2f1d273796dd15e8c0372423ee56c29cdf56ba64 /usr.bin/ftp
parentc35cba881ce110f3c6bbc7e4b608445ce34ad7ca (diff)
downloadFreeBSD-src-92446000b5bac2ba7980291070f3cc67ce6c1299.zip
FreeBSD-src-92446000b5bac2ba7980291070f3cc67ce6c1299.tar.gz
Fix several problems with EPSV (verbosity, one-per-session, missing place)
Approved by: jkh
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/ftp.c18
-rw-r--r--usr.bin/ftp/ftp_var.h1
-rw-r--r--usr.bin/ftp/util.c1
3 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c
index 1fdda41..3617376 100644
--- a/usr.bin/ftp/ftp.c
+++ b/usr.bin/ftp/ftp.c
@@ -1173,8 +1173,6 @@ initconn()
#endif
if (passivemode) {
- static int try_epsv = 1;
-
data_addr = myctladdr;
data = socket(data_addr.su_family, SOCK_STREAM, 0);
if (data < 0) {
@@ -1206,10 +1204,16 @@ initconn()
warn("setsockopt (ignored)");
switch (data_addr.su_family) {
case AF_INET:
- if (try_epsv != 0) {
+ if (try_epsv) {
+ int overbose;
+
+ overbose = verbose;
+ if (debug == 0)
+ verbose = -1;
result = command(pasvcmd = "EPSV");
+ verbose = overbose;
if (code / 10 == 22 && code != 229) {
- puts("wrong server: return code must be 229");
+ puts("wrong server: EPSV return code must be 229");
result = COMPLETE + 1;
}
} else
@@ -1223,7 +1227,7 @@ initconn()
case AF_INET6:
result = command(pasvcmd = "EPSV");
if (code / 10 == 22 && code != 229) {
- puts("wrong server: return code must be 229");
+ puts("wrong server: EPSV return code must be 229");
result = COMPLETE + 1;
}
if (result != COMPLETE)
@@ -1711,7 +1715,9 @@ proxtrans(cmd, local, remote)
}
if (curtype != prox_type)
changetype(prox_type, 1);
- if (command("PASV") != COMPLETE) {
+ if (try_epsv && command("EPSV") != COMPLETE)
+ try_epsv = 0;
+ if (!try_epsv && command("PASV") != COMPLETE) {
puts("proxy server does not support third party transfers.");
return;
}
diff --git a/usr.bin/ftp/ftp_var.h b/usr.bin/ftp/ftp_var.h
index 8694bcc..75cb5da 100644
--- a/usr.bin/ftp/ftp_var.h
+++ b/usr.bin/ftp/ftp_var.h
@@ -120,6 +120,7 @@ int anonftp; /* automatic anonymous login */
int dirchange; /* remote directory changed by cd command */
int ttywidth; /* width of tty */
char *tmpdir; /* temporary directory */
+int try_epsv; /* try EPSV for this session */
#ifndef SMALL
int editing; /* command line editing enabled */
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index a62565c..4aa315c 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -117,6 +117,7 @@ setpeer(argc, argv)
}
connected = 1;
+ try_epsv = 1;
/*
* Set up defaults for FTP.
*/
OpenPOWER on IntegriCloud