summaryrefslogtreecommitdiffstats
path: root/usr.bin/ncftp
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1994-10-07 07:48:18 +0000
committerpst <pst@FreeBSD.org>1994-10-07 07:48:18 +0000
commitc4c79c211eaabb6fb1e467c75c520919a77e599c (patch)
treec9c79bc7861e27f8baba2b84f7dfd4e363aa8bbe /usr.bin/ncftp
parentee674f1a0d1f2ae8f99f23fd76f0de22b4fc029c (diff)
downloadFreeBSD-src-c4c79c211eaabb6fb1e467c75c520919a77e599c.zip
FreeBSD-src-c4c79c211eaabb6fb1e467c75c520919a77e599c.tar.gz
Back out the fluff, leave the meat
Diffstat (limited to 'usr.bin/ncftp')
-rw-r--r--usr.bin/ncftp/Makefile2
-rw-r--r--usr.bin/ncftp/cmds.c11
-rw-r--r--usr.bin/ncftp/cmds.h3
-rw-r--r--usr.bin/ncftp/cmdtab.c5
-rw-r--r--usr.bin/ncftp/ftp.c8
-rw-r--r--usr.bin/ncftp/ncftp.13
6 files changed, 30 insertions, 2 deletions
diff --git a/usr.bin/ncftp/Makefile b/usr.bin/ncftp/Makefile
index 5d13f04..a93ff77 100644
--- a/usr.bin/ncftp/Makefile
+++ b/usr.bin/ncftp/Makefile
@@ -7,7 +7,7 @@ DPADD= $(LIBREADLINE) $(LIBTERMCAP)
LDADD= -lreadline -ltermcap
CFLAGS+= -DGZCAT=\"/usr/bin/gzcat\" -DREADLINE -DCURSES -DNO_CURSES_H \
- -DSYSLOG -DTRY_ABOR -DGATEWAY
+ -DSYSLOG -DTRY_ABOR -DGATEWAY -DPASSIVEMODE
MK= $(CC) $(CFLAGS) $(LDADD)
diff --git a/usr.bin/ncftp/cmds.c b/usr.bin/ncftp/cmds.c
index 9a9b0fc..8b82152 100644
--- a/usr.bin/ncftp/cmds.c
+++ b/usr.bin/ncftp/cmds.c
@@ -36,12 +36,14 @@
#include "copyright.h"
/* cmds.c globals */
+#ifdef PASSIVEMODE
+int passivemode; /* no reverse FTP connections */
+#endif
int curtype; /* file transfer type */
char *typeabbrs = "abiet";
str32 curtypename; /* name of file transfer type */
int verbose; /* verbosity level of output */
int mprompt; /* interactively prompt on m* cmds */
-int passivemode; /* use passive ftp connections */
int debug; /* debugging level */
int options; /* used during socket creation */
int macnum; /* number of defined macros */
@@ -2057,6 +2059,10 @@ int show_version(int argc, char **argv)
#ifdef NET_ERRNO_H
DStrs[nDStrs++] = "NET_ERRNO_H";
#endif
+#ifdef PASSIVEMODE
+ DStrs[nDStrs++] = "PASSIVEMODE";
+#endif
+
/* DONE with #ifdefs for now! */
@@ -2209,11 +2215,14 @@ int unimpl(int argc, char **argv)
return (NOERR);
} /* unimpl */
+#ifdef PASSIVEMODE
int setpassive(int argc, char **argv)
{
passivemode = !passivemode;
printf( "Passive mode %s.\n", (passivemode ? "ON" : "OFF") );
return NOERR;
}
+#endif
+
/* eof cmds.c */
diff --git a/usr.bin/ncftp/cmds.h b/usr.bin/ncftp/cmds.h
index 05fbe3e..11dff6a 100644
--- a/usr.bin/ncftp/cmds.h
+++ b/usr.bin/ncftp/cmds.h
@@ -121,7 +121,10 @@ int unimpl(int argc, char **argv);
long GetDateSizeFromLSLine(char *fName, unsigned long *mod_time);
long GetDateAndSize(char *fName, unsigned long *mod_time);
int SetTypeByNumber(int i);
+#ifdef PASSIVEMODE
int setpassive(int argc, char **argv);
+#endif
+
/* In util.c: */
void cmd_help(struct cmd *c);
diff --git a/usr.bin/ncftp/cmdtab.c b/usr.bin/ncftp/cmdtab.c
index 86d4a5f..d4e161f 100644
--- a/usr.bin/ncftp/cmdtab.c
+++ b/usr.bin/ncftp/cmdtab.c
@@ -90,7 +90,10 @@ Examples:\n\
#define PAGEHELP "view a file on the remote host with your $PAGER"
#define PAGEUSAGE REMOTEFILE
+#ifdef PASSIVEMODE
#define PASSIVEHELP "enter passive transfer mode"
+#endif
+
#define PDIRUSAGE " [flags] [remote-files]"
@@ -188,7 +191,9 @@ struct cmd cmdtab[] = {
{ "ntrans", 0, 1, unimpl, UNIMPLHELP, UNIMPLUSAGE },
{ "open", 0, 0, cmdOpen, OPENHELP, OPENUSAGE },
{ "p", 1, 1, get, PAGEHELP, PAGEUSAGE },
+#ifdef PASSIVEMODE
{ "passive", 0, 0, setpassive, PASSIVEHELP, EMPTYSTR },
+#endif
{ "page", 1, 0, get, PAGEHELP, PAGEUSAGE },
{ "pdir", 1, 0, ls,
"view a remote directory listing (long mode) with your $PAGER",
diff --git a/usr.bin/ncftp/ftp.c b/usr.bin/ncftp/ftp.c
index d8413ad..71f7abe 100644
--- a/usr.bin/ncftp/ftp.c
+++ b/usr.bin/ncftp/ftp.c
@@ -99,7 +99,9 @@ extern struct userinfo uinfo;
extern struct macel macros[];
extern struct lslist *lshead, *lstail;
extern int is_ls;
+#ifdef PASSIVEMODE
extern int passivemode;
+#endif
#ifdef GATEWAY
extern string gateway;
@@ -1691,11 +1693,14 @@ int initconn(void)
int on = 1, rval;
string str;
Sig_t oldintr;
+#ifdef PASSIVEMODE
int a1, a2, a3, a4, p1, p2;
unsigned char n[6];
+#endif
oldintr = Signal(SIGINT, SIG_IGN);
+#ifdef PASSIVEMODE
if (passivemode) {
data = socket(AF_INET, SOCK_STREAM, 0);
if (data < 0) {
@@ -1745,6 +1750,7 @@ int initconn(void)
rval = 0;
goto Return;
}
+#endif
noport:
data_addr = myctladdr;
@@ -1853,8 +1859,10 @@ dataconn(char *mode)
#ifdef SOCKS
s = Raccept(data, (struct sockaddr *) &from, &fromlen);
#else
+#ifdef PASSIVEMODE
if (passivemode)
return( fdopen( data, mode ));
+#endif
s = Accept(data, &from, &fromlen);
#endif
if (s < 0) {
diff --git a/usr.bin/ncftp/ncftp.1 b/usr.bin/ncftp/ncftp.1
index 37cf474..8eaf758 100644
--- a/usr.bin/ncftp/ncftp.1
+++ b/usr.bin/ncftp/ncftp.1
@@ -1257,6 +1257,9 @@ disables reading of the RC file;
this is provided for compatibility with
.RB `` "ftp \-n" ''.
.TP
+.B \-P
+toggle passive mode (defaults to on). Useful for work behind firewalls.
+.TP
.BI \-V " x"
sets verbosity to level
.I x
OpenPOWER on IntegriCloud