(a) there's no reason for PASSIVEMODE to be conditionally compiled since it's
controlled by a runtime switch. (b) add '-P' to toggle passive mode from the command line (c) turn on passive mode by default - passive mode ftp works on all but a few servers out there - it's easy to disable - no, standard ftp should not run with passive enabled by default, but that doesn't matter because I've already fixed standard mode ftp to take a switch This really should have been implemented as a ncftp "set" command instead of carrying over the same hack that was done to ftp. I will go back and fix it some day.
This commit is contained in:
parent
d3c17c0e3d
commit
978451f728
@ -7,7 +7,7 @@ DPADD= $(LIBREADLINE) $(LIBTERMCAP)
|
||||
LDADD= -lreadline -ltermcap
|
||||
|
||||
CFLAGS+= -DGZCAT=\"/usr/bin/gzcat\" -DREADLINE -DCURSES -DNO_CURSES_H \
|
||||
-DSYSLOG -DTRY_ABOR -DGATEWAY -DPASSIVEMODE
|
||||
-DSYSLOG -DTRY_ABOR -DGATEWAY
|
||||
|
||||
MK= $(CC) $(CFLAGS) $(LDADD)
|
||||
|
||||
|
@ -36,14 +36,12 @@
|
||||
#include "copyright.h"
|
||||
|
||||
/* cmds.c globals */
|
||||
#ifdef PASSIVEMODE
|
||||
int passivemode = 0;
|
||||
#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 */
|
||||
@ -2059,10 +2057,6 @@ 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! */
|
||||
|
||||
@ -2215,14 +2209,11 @@ 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 */
|
||||
|
@ -121,10 +121,7 @@ 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);
|
||||
|
@ -90,10 +90,7 @@ 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]"
|
||||
|
||||
@ -191,9 +188,7 @@ 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",
|
||||
|
@ -44,6 +44,10 @@
|
||||
#define dMPROMPT 0
|
||||
#endif
|
||||
|
||||
#ifndef dPASSIVE
|
||||
#define dPASSIVE 1 /* Works for most folks... */
|
||||
#endif
|
||||
|
||||
#ifndef dVERBOSE /* V_QUIET, V_ERRS, V_TERSE, V_VERBOSE */
|
||||
#define dVERBOSE V_TERSE
|
||||
#endif
|
||||
|
@ -99,9 +99,7 @@ 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;
|
||||
@ -1693,14 +1691,11 @@ 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) {
|
||||
@ -1750,7 +1745,6 @@ int initconn(void)
|
||||
rval = 0;
|
||||
goto Return;
|
||||
}
|
||||
#endif
|
||||
|
||||
noport:
|
||||
data_addr = myctladdr;
|
||||
@ -1859,10 +1853,8 @@ 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) {
|
||||
|
@ -116,7 +116,7 @@ static char tcbuf[2048];
|
||||
#endif
|
||||
|
||||
/* main.c externs */
|
||||
extern int debug, verbose, mprompt;
|
||||
extern int debug, verbose, mprompt, passivemode;
|
||||
extern int options, cpend, data, connected, logged_in;
|
||||
extern int curtype, macnum, remote_is_unix;
|
||||
extern FILE *cout;
|
||||
@ -175,6 +175,7 @@ Re-compile, this time with -DZCAT=\\\"/path/to/zcat\\\".\n");
|
||||
mprompt = dMPROMPT;
|
||||
debug = dDEBUG;
|
||||
verbose = dVERBOSE;
|
||||
passivemode = dPASSIVE;
|
||||
(void) Strncpy(vstr, short_verbose_msgs[verbose+1]);
|
||||
|
||||
(void) Strncpy(curtypename, dTYPESTR);
|
||||
@ -270,6 +271,10 @@ Re-compile, this time with -DZCAT=\\\"/path/to/zcat\\\".\n");
|
||||
++ignore_rc;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
passivemode = !passivemode;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
(void) show_version(0, NULL);
|
||||
exit (0);
|
||||
@ -282,6 +287,7 @@ Program Options:\n\
|
||||
-H : Show version and compilation information.\n\
|
||||
-I : Toggle interactive (mprompt) mode.\n\
|
||||
-N : Toggle reading of the .netrc/.ncftprc.\n\
|
||||
-P : Toggle passive mode ftp (for use behind firewalls).\n\
|
||||
-V x : Set verbosity to level x (-1,0,1,2).\n\
|
||||
Open Options:\n\
|
||||
-a : Open anonymously (this is the default).\n\
|
||||
|
Loading…
Reference in New Issue
Block a user