diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 1e46635..2a405d7 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1864,6 +1864,12 @@ LOOP: return(new); } +void setpassive(int argc, char **argv) +{ + code = togglevar(argc, argv, &passivemode, + verbose ? "Passive mode" : (char *)NULL); +} + void setsunique (int argc, char **argv) { code = togglevar(argc, argv, &sunique, "Store unique"); diff --git a/usr.bin/ftp/cmds.h b/usr.bin/ftp/cmds.h index cb05921..118c9a8 100644 --- a/usr.bin/ftp/cmds.h +++ b/usr.bin/ftp/cmds.h @@ -10,6 +10,7 @@ void setbell (int argc, char **argv); void settrace (int argc, char **argv); void sethash (int argc, char **argv); void setverbose (int argc, char **argv); +void setpassive (int argc, char **argv); void setport (int argc, char **argv); void setprompt (int argc, char **argv); void setglob (int argc, char **argv); diff --git a/usr.bin/ftp/cmdtab.c b/usr.bin/ftp/cmdtab.c index 3c572ab..1558f83 100644 --- a/usr.bin/ftp/cmdtab.c +++ b/usr.bin/ftp/cmdtab.c @@ -49,6 +49,7 @@ char newerhelp[] = "get file if remote file is newer than local file "; char nlisthelp[] = "nlist contents of remote directory"; char nmaphelp[] = "set templates for default file name mapping"; char ntranshelp[] = "set translation table for default file name mapping"; +char passivehelp[] = "enter passive transfer mode"; char porthelp[] = "toggle use of PORT cmd for each data connection"; char prompthelp[] = "force interactive prompting on multiple commands"; char proxyhelp[] = "issue command on alternate connection"; @@ -122,6 +123,7 @@ struct cmd cmdtab[] = { { "nlist", nlisthelp, 1, 1, 1, ls }, { "ntrans", ntranshelp, 0, 0, 1, setntrans }, { "open", connecthelp, 0, 0, 1, setpeer }, + { "passive", passivehelp, 0, 0, 0, setpassive }, { "prompt", prompthelp, 0, 0, 0, setprompt }, { "proxy", proxyhelp, 0, 0, 1, doproxy }, { "sendport", porthelp, 0, 0, 0, setport }, diff --git a/usr.bin/ftp/ftp.var.h b/usr.bin/ftp/ftp.var.h index 957a2a9..5c909e3 100644 --- a/usr.bin/ftp/ftp.var.h +++ b/usr.bin/ftp/ftp.var.h @@ -61,6 +61,7 @@ extern int mapflag; /* use mapin mapout templates on file names */ extern int code; /* return/reply code for ftp command */ extern int crflag; /* if 1, strip car. rets. on ascii gets */ extern char pasv[64]; /* passive port for proxy data connection */ +extern int passivemode; /* passive mode enabled */ extern char *altarg; /* argv[1] with no shell-like preprocessing */ extern char ntin[17]; /* input translation table */ extern char ntout[17]; /* output translation table */ diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index 1a68ebc..72835b0 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -53,6 +53,7 @@ static char homedir[MAXPATHLEN]; doglob = 1; interactive = 1; autologin = 1; + passivemode = 1; argc--, argv++; while (argc > 0 && **argv == '-') { for (cp = *argv + 1; *cp; cp++)