summaryrefslogtreecommitdiff
path: root/usr.bin/ftp
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/ftp_var.h172
-rw-r--r--usr.bin/ftp/main.c108
2 files changed, 193 insertions, 87 deletions
diff --git a/usr.bin/ftp/ftp_var.h b/usr.bin/ftp/ftp_var.h
index 2d806d5771c..2f5e952b991 100644
--- a/usr.bin/ftp/ftp_var.h
+++ b/usr.bin/ftp/ftp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp_var.h,v 1.44 2019/11/18 04:37:35 deraadt Exp $ */
+/* $OpenBSD: ftp_var.h,v 1.45 2020/09/01 12:33:48 jca Exp $ */
/* $NetBSD: ftp_var.h,v 1.18 1997/08/18 10:20:25 lukem Exp $ */
/*
@@ -95,104 +95,104 @@
/*
* Options and other state info.
*/
-int trace; /* trace packets exchanged */
-int hash; /* print # for each buffer transferred */
-int mark; /* number of bytes between hashes */
-int sendport; /* use PORT/LPRT cmd for each data connection */
-int verbose; /* print messages coming back from server */
-int connected; /* 1 = connected to server, -1 = logged in */
-int fromatty; /* input is from a terminal */
-int interactive; /* interactively prompt on m* cmds */
+extern int trace; /* trace packets exchanged */
+extern int hash; /* print # for each buffer transferred */
+extern int mark; /* number of bytes between hashes */
+extern int sendport; /* use PORT/LPRT cmd for each data connection */
+extern int verbose; /* print messages coming back from server */
+extern int connected; /* 1 = connected to server, -1 = logged in */
+extern int fromatty; /* input is from a terminal */
+extern int interactive; /* interactively prompt on m* cmds */
#ifndef SMALL
-int confirmrest; /* confirm rest of current m* cmd */
-int debug; /* debugging level */
-int bell; /* ring bell on cmd completion */
-char *altarg; /* argv[1] with no shell-like preprocessing */
+extern int confirmrest; /* confirm rest of current m* cmd */
+extern int debug; /* debugging level */
+extern int bell; /* ring bell on cmd completion */
+extern char *altarg; /* argv[1] with no shell-like preprocessing */
#endif /* !SMALL */
-int doglob; /* glob local file names */
-int autologin; /* establish user account on connection */
-int proxy; /* proxy server connection active */
-int proxflag; /* proxy connection exists */
-int gatemode; /* use gate-ftp */
-char *gateserver; /* server to use for gate-ftp */
-int sunique; /* store files on server with unique name */
-int runique; /* store local files with unique name */
-int mcase; /* map upper to lower case for mget names */
-int ntflag; /* use ntin ntout tables for name translation */
-int mapflag; /* use mapin mapout templates on file names */
-int preserve; /* preserve modification time on files */
-int progress; /* display transfer progress bar */
-int code; /* return/reply code for ftp command */
-int crflag; /* if 1, strip car. rets. on ascii gets */
-char pasv[BUFSIZ]; /* passive port for proxy data connection */
-int passivemode; /* passive mode enabled */
-int activefallback; /* fall back to active mode if passive fails */
-char ntin[17]; /* input translation table */
-char ntout[17]; /* output translation table */
-char mapin[PATH_MAX]; /* input map template */
-char mapout[PATH_MAX]; /* output map template */
-char typename[32]; /* name of file transfer type */
-int type; /* requested file transfer type */
-int curtype; /* current file transfer type */
-char structname[32]; /* name of file transfer structure */
-int stru; /* file transfer structure */
-char formname[32]; /* name of file transfer format */
-int form; /* file transfer format */
-char modename[32]; /* name of file transfer mode */
-int mode; /* file transfer mode */
-char bytename[32]; /* local byte size in ascii */
-int bytesize; /* local byte size in binary */
-int anonftp; /* automatic anonymous login */
-int dirchange; /* remote directory changed by cd command */
-unsigned int retry_connect; /* retry connect if failed */
-int ttywidth; /* width of tty */
-int epsv4; /* use EPSV/EPRT on IPv4 connections */
-int epsv4bad; /* EPSV doesn't work on the current server */
+extern int doglob; /* glob local file names */
+extern int autologin; /* establish user account on connection */
+extern int proxy; /* proxy server connection active */
+extern int proxflag; /* proxy connection exists */
+extern int gatemode; /* use gate-ftp */
+extern char *gateserver; /* server to use for gate-ftp */
+extern int sunique; /* store files on server with unique name */
+extern int runique; /* store local files with unique name */
+extern int mcase; /* map upper to lower case for mget names */
+extern int ntflag; /* use ntin ntout tables for name translation */
+extern int mapflag; /* use mapin mapout templates on file names */
+extern int preserve; /* preserve modification time on files */
+extern int progress; /* display transfer progress bar */
+extern int code; /* return/reply code for ftp command */
+extern int crflag; /* if 1, strip car. rets. on ascii gets */
+extern char pasv[BUFSIZ]; /* passive port for proxy data connection */
+extern int passivemode; /* passive mode enabled */
+extern int activefallback; /* fall back to active mode if passive fails */
+extern char ntin[17]; /* input translation table */
+extern char ntout[17]; /* output translation table */
+extern char mapin[PATH_MAX]; /* input map template */
+extern char mapout[PATH_MAX]; /* output map template */
+extern char typename[32]; /* name of file transfer type */
+extern int type; /* requested file transfer type */
+extern int curtype; /* current file transfer type */
+extern char structname[32]; /* name of file transfer structure */
+extern int stru; /* file transfer structure */
+extern char formname[32]; /* name of file transfer format */
+extern int form; /* file transfer format */
+extern char modename[32]; /* name of file transfer mode */
+extern int mode; /* file transfer mode */
+extern char bytename[32]; /* local byte size in ascii */
+extern int bytesize; /* local byte size in binary */
+extern int anonftp; /* automatic anonymous login */
+extern int dirchange; /* remote directory changed by cd command */
+extern unsigned int retry_connect; /* retry connect if failed */
+extern int ttywidth; /* width of tty */
+extern int epsv4; /* use EPSV/EPRT on IPv4 connections */
+extern int epsv4bad; /* EPSV doesn't work on the current server */
#ifndef SMALL
-int editing; /* command line editing enabled */
-EditLine *el; /* editline(3) status structure */
-History *hist; /* editline(3) history structure */
-char *cursor_pos; /* cursor position we're looking for */
-size_t cursor_argc; /* location of cursor in margv */
-size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
-int resume; /* continue transfer */
-char *srcaddr; /* source address to bind to */
+extern int editing; /* command line editing enabled */
+extern EditLine *el; /* editline(3) status structure */
+extern History *hist; /* editline(3) history structure */
+extern char *cursor_pos; /* cursor position we're looking for */
+extern size_t cursor_argc; /* location of cursor in margv */
+extern size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
+extern int resume; /* continue transfer */
+extern char *srcaddr; /* source address to bind to */
#endif /* !SMALL */
-char *cookiefile; /* cookie jar to use */
+extern char *cookiefile; /* cookie jar to use */
-off_t bytes; /* current # of bytes read */
-off_t filesize; /* size of file being transferred */
-char *direction; /* direction transfer is occurring */
+extern off_t bytes; /* current # of bytes read */
+extern off_t filesize; /* size of file being transferred */
+extern char *direction; /* direction transfer is occurring */
-char *hostname; /* name of host connected to */
-int unix_server; /* server is unix, can use binary for ascii */
-int unix_proxy; /* proxy is unix, can use binary for ascii */
+extern char *hostname; /* name of host connected to */
+extern int unix_server; /* server is unix, can use binary for ascii */
+extern int unix_proxy; /* proxy is unix, can use binary for ascii */
-char *ftpport; /* port number to use for ftp connections */
-char *httpport; /* port number to use for http connections */
+extern char *ftpport; /* port number to use for ftp connections */
+extern char *httpport; /* port number to use for http connections */
#ifndef NOSSL
-char *httpsport; /* port number to use for https connections */
+extern char *httpsport; /* port number to use for https connections */
#endif /* !SMALL */
-char *httpuseragent; /* user agent for http(s) connections */
-char *gateport; /* port number to use for gateftp connections */
+extern char *httpuseragent; /* user agent for http(s) connections */
+extern char *gateport; /* port number to use for gateftp connections */
-jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
+extern jmp_buf toplevel; /* non-local goto stuff for cmd scanner */
#ifndef SMALL
-char line[FTPBUFLEN]; /* input line buffer */
-char *argbase; /* current storage point in arg buffer */
-char *stringbase; /* current scan point in line buffer */
-char argbuf[FTPBUFLEN]; /* argument storage buffer */
-StringList *marg_sl; /* stringlist containing margv */
-int margc; /* count of arguments on input line */
-int options; /* used during socket creation */
+extern char line[FTPBUFLEN]; /* input line buffer */
+extern char *argbase; /* current storage point in arg buffer */
+extern char *stringbase; /* current scan point in line buffer */
+extern char argbuf[FTPBUFLEN]; /* argument storage buffer */
+extern StringList *marg_sl; /* stringlist containing margv */
+extern int margc; /* count of arguments on input line */
+extern int options; /* used during socket creation */
#endif /* !SMALL */
#define margv (marg_sl->sl_str) /* args parsed from input line */
-int cpend; /* flag: if != 0, then pending server reply */
-int mflag; /* flag: if != 0, then active multi command */
+extern int cpend; /* flag: if != 0, then pending server reply */
+extern int mflag; /* flag: if != 0, then active multi command */
/*
* Format of command table.
@@ -216,12 +216,12 @@ struct macel {
};
#ifndef SMALL
-int macnum; /* number of defined macros */
-struct macel macros[16];
-char macbuf[4096];
+extern int macnum; /* number of defined macros */
+extern struct macel macros[16];
+extern char macbuf[4096];
#endif /* !SMALL */
-FILE *ttyout; /* stdout or stderr, depending on interactive */
+extern FILE *ttyout; /* stdout or stderr, depending on interactive */
extern struct cmd cmdtab[];
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index d29caa7e09f..660eb04e9ff 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.131 2020/02/11 18:41:39 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.132 2020/09/01 12:33:48 jca Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -81,6 +81,112 @@
#include "cmds.h"
#include "ftp_var.h"
+int trace;
+int hash;
+int mark;
+int sendport;
+int verbose;
+int connected;
+int fromatty;
+int interactive;
+#ifndef SMALL
+int confirmrest;
+int debug;
+int bell;
+char *altarg;
+#endif /* !SMALL */
+int doglob;
+int autologin;
+int proxy;
+int proxflag;
+int gatemode;
+char *gateserver;
+int sunique;
+int runique;
+int mcase;
+int ntflag;
+int mapflag;
+int preserve;
+int progress;
+int code;
+int crflag;
+char pasv[BUFSIZ];
+int passivemode;
+int activefallback;
+char ntin[17];
+char ntout[17];
+char mapin[PATH_MAX];
+char mapout[PATH_MAX];
+char typename[32];
+int type;
+int curtype;
+char structname[32];
+int stru;
+char formname[32];
+int form;
+char modename[32];
+int mode;
+char bytename[32];
+int bytesize;
+int anonftp;
+int dirchange;
+unsigned int retry_connect;
+int ttywidth;
+int epsv4;
+int epsv4bad;
+
+#ifndef SMALL
+int editing;
+EditLine *el;
+History *hist;
+char *cursor_pos;
+size_t cursor_argc;
+size_t cursor_argo;
+int resume;
+char *srcaddr;
+#endif /* !SMALL */
+
+char *cookiefile;
+
+off_t bytes;
+off_t filesize;
+char *direction;
+
+char *hostname;
+int unix_server;
+int unix_proxy;
+
+char *ftpport;
+char *httpport;
+#ifndef NOSSL
+char *httpsport;
+#endif /* !SMALL */
+char *httpuseragent;
+char *gateport;
+
+jmp_buf toplevel;
+
+#ifndef SMALL
+char line[FTPBUFLEN];
+char *argbase;
+char *stringbase;
+char argbuf[FTPBUFLEN];
+StringList *marg_sl;
+int margc;
+int options;
+#endif /* !SMALL */
+
+int cpend;
+int mflag;
+
+#ifndef SMALL
+int macnum;
+struct macel macros[16];
+char macbuf[4096];
+#endif /* !SMALL */
+
+FILE *ttyout;
+
int connect_timeout;
#ifndef NOSSL