summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1994-09-29 20:55:25 +0000
committerpst <pst@FreeBSD.org>1994-09-29 20:55:25 +0000
commitbc1378c899feed3395ae56bf6006a483d7d9ab92 (patch)
tree459b9d758e9dc7548e339c1c902cf0bff4a8c962 /usr.bin/ftp
parentdef775d41d9008a9bd6b2b65d1bdbaf8d448a2e7 (diff)
downloadFreeBSD-src-bc1378c899feed3395ae56bf6006a483d7d9ab92.zip
FreeBSD-src-bc1378c899feed3395ae56bf6006a483d7d9ab92.tar.gz
Add -p flag and pftp alias for passive ftp
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/Makefile2
-rw-r--r--usr.bin/ftp/ftp.13
-rw-r--r--usr.bin/ftp/main.c16
3 files changed, 18 insertions, 3 deletions
diff --git a/usr.bin/ftp/Makefile b/usr.bin/ftp/Makefile
index fbb5a91..dc8197f 100644
--- a/usr.bin/ftp/Makefile
+++ b/usr.bin/ftp/Makefile
@@ -2,5 +2,7 @@
PROG= ftp
SRCS= cmds.c cmdtab.c ftp.c main.c ruserpass.c domacro.c
+LINKS= ${BINDIR}/ftp ${BINDIR}/pftp
+MLINKS= ftp.1 pftp.1
.include <bsd.prog.mk>
diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1
index 417da08..4790407 100644
--- a/usr.bin/ftp/ftp.1
+++ b/usr.bin/ftp/ftp.1
@@ -45,6 +45,7 @@ file transfer program
.Op Fl d
.Op Fl i
.Op Fl n
+.Op Fl p
.Op Fl g
.Op Ar host
.Sh DESCRIPTION
@@ -85,6 +86,8 @@ multiple file transfers.
Enables debugging.
.It Fl g
Disables file name globbing.
+.It Fl p
+Enable passive mode operation for use behind connection filtering firewalls.
.El
.Pp
The client host with which
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index 52a95b0..0edff5e 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -58,6 +58,7 @@ static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 4/3/94";
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include "ftp_var.h"
@@ -76,8 +77,14 @@ main(argc, argv)
doglob = 1;
interactive = 1;
autologin = 1;
+ passivemode = 0;
- while ((ch = getopt(argc, argv, "dgintv")) != EOF) {
+ cp = strrchr(argv[0], '/');
+ cp = (cp == NULL) ? argv[0] : cp+1;
+ if (strcmp(cp, "pftp") == 0)
+ passivemode = 1;
+
+ while ((ch = getopt(argc, argv, "dginptv")) != EOF) {
switch (ch) {
case 'd':
options |= SO_DEBUG;
@@ -96,6 +103,10 @@ main(argc, argv)
autologin = 0;
break;
+ case 'p':
+ passivemode = 1;
+ break;
+
case 't':
trace++;
break;
@@ -106,7 +117,7 @@ main(argc, argv)
default:
(void)fprintf(stderr,
- "usage: ftp [-dgintv] [host [port]]\n");
+ "usage: ftp [-dginptv] [host [port]]\n");
exit(1);
}
}
@@ -118,7 +129,6 @@ main(argc, argv)
verbose++;
cpend = 0; /* no pending replies */
proxy = 0; /* proxy not active */
- passivemode = 0;/* passive mode not active */
crflag = 1; /* strip c.r. on ascii gets */
sendport = -1; /* not using ports */
/*
OpenPOWER on IntegriCloud