Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Feb 2000 15:26:05 -0800
From:      "Andrey A. Chernov" <ache@freebsd.org>
To:        Yoshinobu Inoue <shin@nd.net.fujitsu.co.jp>
Cc:        saxonww@ufl.edu, current@FreeBSD.ORG
Subject:   EPSV patch for review (was Re: Broken FTP)
Message-ID:  <20000220152605.A59931@freebsd.org>
In-Reply-To: <20000220150126.A54323@freebsd.org>; from ache@freebsd.org on Sun, Feb 20, 2000 at 03:01:26PM -0800
References:  <20000218103132.A74763@freebsd.org> <20000219044734W.shin@nd.net.fujitsu.co.jp> <20000218152417.A52305@freebsd.org> <20000219181917Q.shin@nd.net.fujitsu.co.jp> <20000220133701.A27747@freebsd.org> <20000220135605.A38025@freebsd.org> <20000220150126.A54323@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Please review this patch. It fix all problems I mention.

--- ftp.c.old	Sun Feb 20 23:30:29 2000
+++ ftp.c	Mon Feb 21 02:21:01 2000
@@ -1173,8 +1173,6 @@
 #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 @@
 			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 @@
 		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 @@
 	}
 	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;
 	}
--- util.c.old	Mon Feb  7 08:53:26 2000
+++ util.c	Mon Feb 21 02:13:20 2000
@@ -117,6 +117,7 @@
 		}
 
 		connected = 1;
+		try_epsv = 1;
 		/*
 		 * Set up defaults for FTP.
 		 */
--- ftp_var.h.old	Mon Feb 14 21:31:56 2000
+++ ftp_var.h	Mon Feb 21 02:13:20 2000
@@ -120,6 +120,7 @@
 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 */

-- 
Andrey A. Chernov
<ache@nagual.pp.ru>
http://nagual.pp.ru/~ache/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000220152605.A59931>