diff options
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c | 67 | ||||
-rw-r--r-- | gnu/usr.bin/lynx/lynx.cfg | 3 | ||||
-rw-r--r-- | gnu/usr.bin/lynx/src/LYGlobalDefs.h | 1 | ||||
-rw-r--r-- | gnu/usr.bin/lynx/src/LYMain.c | 1 | ||||
-rw-r--r-- | gnu/usr.bin/lynx/src/LYReadCFG.c | 1 | ||||
-rw-r--r-- | gnu/usr.bin/lynx/userdefs.h | 6 |
6 files changed, 31 insertions, 48 deletions
diff --git a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c index 5507254cf95..7924b0bacdc 100644 --- a/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c +++ b/gnu/usr.bin/lynx/WWW/Library/Implementation/HTFTP.c @@ -38,11 +38,6 @@ ** and code to parse dates and sizes on most hosts. ** 27 Mar 93 (FM) Added code for getting dates and sizes on VMS hosts. ** -** Options: -** LISTEN We listen, the other guy connects for data. -** Otherwise, other way round, but problem finding our -** internet address! -** ** Notes: ** Portions Copyright 1994 Trustees of Dartmouth College ** Code for recognizing different FTP servers and @@ -52,15 +47,6 @@ */ /* -** If LISTEN is not defined, PASV is used instead of PORT, and not -** all FTP servers support PASV, so define it unless there is no -** alternative for your system. -*/ -#ifndef NOPORT -#define LISTEN /* @@@@ Test LJM */ -#endif /* !NOPORT */ - -/* BUGS: @@@ Limit connection cache size! Error reporting to user. 400 & 500 errors are ack'ed by user with windows. @@ -109,6 +95,7 @@ BUGS: @@@ Limit connection cache size! #endif /* !IPORT_FTP */ #include <LYUtils.h> +#include <LYGlobalDefs.h> #include <LYStrings.h> #include <LYLeaks.h> @@ -188,14 +175,11 @@ PRIVATE int interrupted_in_next_data_char = FALSE; PRIVATE unsigned short port_number = FIRST_TCP_PORT; #endif /* POLL_PORTS */ -#ifdef LISTEN PRIVATE int master_socket = -1; /* Listening socket = invalid */ PRIVATE char port_command[255]; /* Command for setting the port */ PRIVATE fd_set open_sockets; /* Mask of active channels */ PRIVATE int num_sockets; /* Number of sockets to scan */ -#else PRIVATE unsigned short passive_port; /* Port server specified for data */ -#endif /* LISTEN */ #define NEXT_CHAR HTGetCharacter() /* Use function in HTFormat.c */ @@ -974,8 +958,6 @@ PRIVATE int get_connection ARGS2( } -#ifdef LISTEN - /* Close Master (listening) socket ** ------------------------------- ** @@ -1171,7 +1153,6 @@ PRIVATE int get_listen_socket NOARGS return master_socket; /* Good */ } /* get_listen_socket */ -#endif /* LISTEN */ PRIVATE char * months[12] = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" @@ -2589,21 +2570,20 @@ PUBLIC int HTFTPLoad ARGS4( if (status < 0) return status; -#ifdef LISTEN - status = get_listen_socket(); - if (status < 0) { - NETCLOSE (control->socket); - control->socket = -1; - close_master_socket (); - /* HT_INTERRUPTED would fall through, if we could interrupt - somehow in the middle of it, which we currently can't. */ - return status; - } + if (!ftp_passive) { + status = get_listen_socket(); + if (status < 0) { + NETCLOSE (control->socket); + control->socket = -1; + close_master_socket (); + /* HT_INTERRUPTED would fall through, if we could interrupt + somehow in the middle of it, which we currently can't. */ + return status; + } #ifdef REPEAT_PORT -/* Inform the server of the port number we will listen on -*/ - { + /* Inform the server of the port number we will listen on + */ status = response(port_command); if (status == HT_INTERRUPTED) { CTRACE (tfp, "HTFTP: Interrupted in response (port_command)\n"); @@ -2619,16 +2599,12 @@ PUBLIC int HTFTPLoad ARGS4( return -status; /* bad reply */ } CTRACE(tfp, "HTFTP: Port defined.\n"); - } #endif /* REPEAT_PORT */ -#else /* Use PASV */ -/* Tell the server to be passive -*/ - { + } else { /* Tell the server to be passive */ char command[LINE_LENGTH+1]; char *p; int reply, h0, h1, h2, h3, p0, p1; /* Parts of reply */ - int status; + data_soc = status; status = send_cmd_1("PASV"); @@ -2668,7 +2644,6 @@ PUBLIC int HTFTPLoad ARGS4( CTRACE(tfp, "FTP data connected, socket %d\n", data_soc); } -#endif /* use PASV */ status = 0; break; /* No more retries */ @@ -3158,10 +3133,8 @@ PUBLIC int HTFTPLoad ARGS4( } listen: -#ifdef LISTEN -/* Wait for the connection -*/ - { + if (!ftp_passive) { + /* Wait for the connection */ struct sockaddr_in soc_address; int soc_addrlen=sizeof(soc_address); #ifdef SOCKS @@ -3180,10 +3153,8 @@ listen: } CTRACE(tfp, "TCP: Accepted new socket %d\n", status); data_soc = status; - } -#else -/* @@ */ -#endif /* LISTEN */ + } /* !ftp_passive */ + if (isDirectory) { status = read_directory (anchor, name, format_out, sink); NETCLOSE(data_soc); diff --git a/gnu/usr.bin/lynx/lynx.cfg b/gnu/usr.bin/lynx/lynx.cfg index 26f20d969a6..236d474b76c 100644 --- a/gnu/usr.bin/lynx/lynx.cfg +++ b/gnu/usr.bin/lynx/lynx.cfg @@ -2095,3 +2095,6 @@ MINIMAL_COMMENTS:TRUE #HTMLSRC_TAGNAME_XFORM:2 #HTMLSRC_ATTRNAME_XFORM:2 +# Set FTP_PASSIVE to TRUE if you want to use passive mode ftp transfers. +# You might have to do this if you're behind a restrictive firewall. +#FTP_PASSIVE:FALSE diff --git a/gnu/usr.bin/lynx/src/LYGlobalDefs.h b/gnu/usr.bin/lynx/src/LYGlobalDefs.h index 8e8d49ba41a..40e7c51ab3e 100644 --- a/gnu/usr.bin/lynx/src/LYGlobalDefs.h +++ b/gnu/usr.bin/lynx/src/LYGlobalDefs.h @@ -169,6 +169,7 @@ extern BOOLEAN recent_sizechange; extern BOOLEAN telnet_ok; extern BOOLEAN news_ok; extern BOOLEAN ftp_ok; +extern BOOLEAN ftp_passive; /* TRUE if we want to use passive mode ftp */ extern BOOLEAN rlogin_ok; extern BOOLEAN system_editor; /* True if locked-down editor */ extern BOOLEAN child_lynx; /* TRUE to exit with an arrow */ diff --git a/gnu/usr.bin/lynx/src/LYMain.c b/gnu/usr.bin/lynx/src/LYMain.c index abfb2f3520d..27cc9e4a6fc 100644 --- a/gnu/usr.bin/lynx/src/LYMain.c +++ b/gnu/usr.bin/lynx/src/LYMain.c @@ -167,6 +167,7 @@ PUBLIC BOOLEAN LYUserSpecifiedURL = TRUE;/* always TRUE the first time */ PUBLIC BOOLEAN LYJumpFileURL = FALSE; /* always FALSE the first time */ PUBLIC BOOLEAN jump_buffer = JUMPBUFFER; /* TRUE if offering default shortcut */ PUBLIC BOOLEAN goto_buffer = GOTOBUFFER; /* TRUE if offering default goto URL */ +PUBLIC BOOLEAN ftp_passive = FTP_PASSIVE; /* TRUE if doing ftp in passive mode */ PUBLIC BOOLEAN recent_sizechange = FALSE;/* the window size changed recently? */ PUBLIC int user_mode = NOVICE_MODE; PUBLIC BOOLEAN dump_output_immediately = FALSE; diff --git a/gnu/usr.bin/lynx/src/LYReadCFG.c b/gnu/usr.bin/lynx/src/LYReadCFG.c index f7142ac635b..e1caa1bab96 100644 --- a/gnu/usr.bin/lynx/src/LYReadCFG.c +++ b/gnu/usr.bin/lynx/src/LYReadCFG.c @@ -1018,6 +1018,7 @@ static Config_Type Config_Table [] = #if !defined(NO_OPTION_FORMS) && !defined(NO_OPTION_MENU) PARSE_SET("forms_options", CONF_BOOL, &LYUseFormsOptions), #endif + PARSE_SET("ftp_passive", CONF_BOOL, &ftp_passive), PARSE_ENV("ftp_proxy", CONF_ENV, 0 ), PARSE_STR("global_extension_map", CONF_STR, &global_extension_map), PARSE_STR("global_mailcap", CONF_STR, &global_type_map), diff --git a/gnu/usr.bin/lynx/userdefs.h b/gnu/usr.bin/lynx/userdefs.h index 3433b4ca67b..b6bda1c9cdd 100644 --- a/gnu/usr.bin/lynx/userdefs.h +++ b/gnu/usr.bin/lynx/userdefs.h @@ -495,6 +495,12 @@ #define GOTOBUFFER FALSE /***************************** + * If FTP_PASSIVE is set to TRUE here or in lynx.cfg, ftp transfers will + * be done in passive mode. + */ +#define FTP_PASSIVE FALSE + +/***************************** * JUMPFILE is the default local file checked for shortcut URLs when * the user presses the 'J' (JUMP) key. The user will be prompted for * a shortcut entry (analogously to 'g'oto), and can enter one |