add epsv4 command, which enable/disable the use of EPSV/EPRT.
this is mainly for (hypothetical) ftp server which disconnect clients that use EPSV/EPRT. I've never seen any ftp server like this, but epsv4 command may be of use when such an ftp server is found.
This commit is contained in:
parent
f77d35e72c
commit
940276557f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cmds.c,v 1.54 1999/07/02 08:07:40 itojun Exp $ */
|
||||
/* $NetBSD: cmds.c,v 1.55 1999/07/11 20:37:39 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
|
@ -107,7 +107,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: cmds.c,v 1.54 1999/07/02 08:07:40 itojun Exp $");
|
||||
__RCSID("$NetBSD: cmds.c,v 1.55 1999/07/11 20:37:39 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -763,6 +763,7 @@ status(argc, argv)
|
|||
"Put transfer rate throttle: %s; maximum: %d; increment %d.\n",
|
||||
onoff(rate_put), rate_put, rate_put_incr);
|
||||
fprintf(ttyout, "Use of PORT cmds: %s.\n", onoff(sendport));
|
||||
fprintf(ttyout, "Use of EPSV/EPRT cmds on IPv4: %s.\n", onoff(epsv4));
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
fprintf(ttyout, "Command line editing: %s.\n", onoff(editing));
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
@ -2472,3 +2473,13 @@ rcvbuf(argc, argv)
|
|||
else
|
||||
rcvbuf_manual = 0;
|
||||
}
|
||||
|
||||
void
|
||||
setepsv4(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
|
||||
code = togglevar(argc, argv, &epsv4,
|
||||
verbose ? "EPSV/EPRT on IPv4" : NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cmdtab.c,v 1.24 1999/07/02 08:07:41 itojun Exp $ */
|
||||
/* $NetBSD: cmdtab.c,v 1.25 1999/07/11 20:37:39 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
|
@ -38,7 +38,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)cmdtab.c 8.4 (Berkeley) 10/9/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: cmdtab.c,v 1.24 1999/07/02 08:07:41 itojun Exp $");
|
||||
__RCSID("$NetBSD: cmdtab.c,v 1.25 1999/07/11 20:37:39 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -69,6 +69,7 @@ char domachelp[] = "execute macro";
|
|||
#ifndef NO_EDITCOMPLETE
|
||||
char edithelp[] = "toggle command line editing";
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
char epsv4help[] = "toggle use of EPSV/EPRT on IPv4 ftp";
|
||||
char formhelp[] = "set file transfer format";
|
||||
char gatehelp[] = "toggle gate-ftp; specify host[:port] to change proxy";
|
||||
char globhelp[] = "toggle metacharacter expansion of local file names";
|
||||
|
@ -161,6 +162,7 @@ struct cmd cmdtab[] = {
|
|||
#ifndef NO_EDITCOMPLETE
|
||||
{ "edit", edithelp, 0, 0, 0, CMPL0 setedit },
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
{ "epsv4", epsv4help, 0, 0, 0, CMPL0 setepsv4 },
|
||||
{ "exit", quithelp, 0, 0, 0, CMPL0 quit },
|
||||
{ "form", formhelp, 0, 1, 1, CMPL0 setform },
|
||||
{ "ftp", connecthelp, 0, 0, 1, CMPL0 setpeer },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.32 1999/07/02 08:07:41 itojun Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.33 1999/07/11 20:37:39 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
|
@ -168,6 +168,7 @@ void setcase __P((int, char **));
|
|||
void setcr __P((int, char **));
|
||||
void setdebug __P((int, char **));
|
||||
void setedit __P((int, char **));
|
||||
void setepsv4 __P((int, char **));
|
||||
void setform __P((int, char **));
|
||||
void setftmode __P((int, char **));
|
||||
void setgate __P((int, char **));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: ftp.1,v 1.44 1999/07/02 08:07:41 itojun Exp $
|
||||
.\" $NetBSD: ftp.1,v 1.45 1999/07/11 20:37:39 itojun Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1985, 1989, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -406,6 +406,17 @@ Toggle command line editing, and context sensitive command and file
|
|||
completion.
|
||||
This is automatically enabled if input is from a terminal, and
|
||||
disabled otherwise.
|
||||
.It Ic epsv4
|
||||
Toggle the use of
|
||||
.Li EPSV/EPRT
|
||||
command on IPv4 connections.
|
||||
This is enabled by default
|
||||
.Po
|
||||
first try
|
||||
.Li EPSV/EPRT ,
|
||||
then
|
||||
.Li PASV/PORT
|
||||
.Pc .
|
||||
.It Ic exit
|
||||
A synonym for
|
||||
.Ic bye .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ftp.c,v 1.53 1999/07/11 00:41:59 christos Exp $ */
|
||||
/* $NetBSD: ftp.c,v 1.54 1999/07/11 20:37:39 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
|
@ -67,7 +67,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ftp.c,v 1.53 1999/07/11 00:41:59 christos Exp $");
|
||||
__RCSID("$NetBSD: ftp.c,v 1.54 1999/07/11 20:37:39 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1284,9 +1284,11 @@ reinit:
|
|||
setsockopt(data, SOL_SOCKET, SO_DEBUG, (char *)&on,
|
||||
sizeof(on)) < 0)
|
||||
warn("setsockopt (ignored)");
|
||||
result = COMPLETE + 1;
|
||||
switch (data_addr.su_family) {
|
||||
case AF_INET:
|
||||
result = command(pasvcmd = "EPSV");
|
||||
if (epsv4)
|
||||
result = command(pasvcmd = "EPSV");
|
||||
if (result != COMPLETE)
|
||||
result = command(pasvcmd = "PASV");
|
||||
break;
|
||||
|
@ -1296,7 +1298,7 @@ reinit:
|
|||
result = command(pasvcmd = "LPSV");
|
||||
break;
|
||||
default:
|
||||
result = COMPLETE + 1;
|
||||
break;
|
||||
}
|
||||
if (result != COMPLETE) {
|
||||
if (activefallback) {
|
||||
|
@ -1471,6 +1473,11 @@ noport:
|
|||
|
||||
switch (data_addr.su_family) {
|
||||
case AF_INET:
|
||||
if (!epsv4) {
|
||||
result = COMPLETE + 1;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case AF_INET6:
|
||||
af = (data_addr.su_family == AF_INET) ? 1 : 2;
|
||||
if (getnameinfo((struct sockaddr *)&data_addr,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ftp_var.h,v 1.34 1999/07/02 08:07:42 itojun Exp $ */
|
||||
/* $NetBSD: ftp_var.h,v 1.35 1999/07/11 20:37:39 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
|
@ -168,6 +168,7 @@ int retry_connect; /* seconds between retrying connection */
|
|||
int ttywidth; /* width of tty */
|
||||
char *tmpdir; /* temporary directory */
|
||||
FILE *ttyout; /* stdout, or stderr if retrieving to stdout */
|
||||
int epsv4; /* use EPSV/EPRT on IPv4 connections */
|
||||
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
int editing; /* command line editing enabled */
|
||||
|
@ -187,15 +188,9 @@ char *hostname; /* name of host connected to */
|
|||
int unix_server; /* server is unix, can use binary for ascii */
|
||||
int unix_proxy; /* proxy is unix, can use binary for ascii */
|
||||
|
||||
#if 0
|
||||
in_port_t ftpport; /* port number to use for FTP connections */
|
||||
in_port_t httpport; /* port number to use for HTTP connections */
|
||||
in_port_t gateport; /* port number to use for gateftp connections */
|
||||
#else
|
||||
char *ftpport; /* port number to use for FTP connections */
|
||||
char *httpport; /* port number to use for HTTP connections */
|
||||
char *gateport; /* port number to use for gateftp connections */
|
||||
#endif
|
||||
|
||||
const char *ftpproxy; /* ftp:// proxy server */
|
||||
const char *httpproxy; /* http:// proxy server */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.46 1999/07/10 19:41:15 christos Exp $ */
|
||||
/* $NetBSD: main.c,v 1.47 1999/07/11 20:37:39 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
|
@ -72,7 +72,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\n\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.46 1999/07/10 19:41:15 christos Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.47 1999/07/11 20:37:39 itojun Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -143,6 +143,7 @@ main(argc, argv)
|
|||
rate_get_incr = DEFAULTINCR;
|
||||
rate_put = 0;
|
||||
rate_put_incr = DEFAULTINCR;
|
||||
epsv4 = 1;
|
||||
|
||||
marg_sl = sl_init();
|
||||
if ((tmpdir = getenv("TMPDIR")) == NULL)
|
||||
|
|
Loading…
Reference in New Issue