summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspz <spz@pkgsrc.org>2014-10-31 18:47:19 +0000
committerspz <spz@pkgsrc.org>2014-10-31 18:47:19 +0000
commit2792e50161ca83c80bb73db29fe70e9221ce689c (patch)
treed47043b7ce6975899267740c5d1d94c94f53f138
parentfc894a6a6b5d30f7073bc82d932d44b3b17a513e (diff)
downloadpkgsrc-2792e50161ca83c80bb73db29fe70e9221ce689c.tar.gz
Fri Oct 31 04:07:38 UTC 2014 lukem
* Release as "tnftp 20141031". * Merge NetBSD usr.bin/ftp from 20130220 to 20141026: - Don't pay attention to special characters if they don't come from the command line (from jmcneill). Fixes CVE-2014-8517. - pr/34796: Hauke Fath: ftp does not timeout on http fetches. Sun May 5 13:51:47 UTC 2013 lukem * Release as "tnftp 20130505" * Implement --enable-ssl (and --with-openssl) to enable https:// fetch support. * Merge NetBSD ftp from 20090520 to 20130220. Changes: - https:// support. NetBSD problem report 47276 from NONAKA Kimihiro. - Allow -R to restart non-existent ftp:// URIs. - Don't assume AF_INET support is available. FreeBSD problem report 162661. - Parse HTTP 'Date' entries in the `C' locale rather than the user's. NetBSD problem report 42917 from KAMADA Ken'ichi. - Improve error handling when parsing of URI scheme. - Silence connection warnings to multi-homed hosts in non-verbose mode. - Fix compile warnings. - In ftpvis(), prevent incomplete escape sequences at end of dst, and ensure NUL-termination of dst. Fix from Uwe Stuehler and Stefan Sperling, via Marc Balmer. - When using the response to SYST to decide whether to default to 'binary' be a lot less specific. * Replace glob with newer copy from NetBSD that does not suffer from DoS exhaustion attacks. Fix in NetBSD from Maksymilian Arciemowicz. See CVE-2011-0418 Tue Jan 12 06:58:15 UTC 2010 lukem * Release as "tnftp 20100108" * Rename onoff() argument "bool" to "val". Tue Jan 5 09:12:01 UTC 2010 lukem * If ARG_MAX isn't defined, use the result from sysconf(_SC_ARG_MAX). Fixes build when using newer glibc. * Add libnetbsd.la to the LIBADD for libedit. Fix provided by Adam Sampson. Mon Jan 4 06:28:07 UTC 2010 lukem * Distribute various files not shipped by default automake rules, to use 'make dist' instead of 'cvs export'. Wed Dec 30 00:12:47 UTC 2009 lukem * Release as "tnftp 20091122" Sun Nov 15 10:14:44 UTC 2009 lukem * Merge NetBSD ftp from 20090520 to 20090915. Change: - Rename internal getline() to get_line() to avoid conflict with libc with former. - Avoid a NULL dereference in an error message. Sat Nov 14 09:21:19 UTC 2009 lukem * Convert to automake & libtool. Sat Jun 6 07:17:38 UTC 2009 lukem * Release as "tnftp 20090606" Fri May 22 01:11:15 UTC 2009 lukem * configure fixes: - Add the time.h headers to accheck_includes, for the strptime check. - Remove the check for el_init in libedit; we're always replacing the library and the presence of strvis() in some versions confuses other checks. Wed May 20 13:47:43 UTC 2009 lukem * Release as "tnftp 20090520" * Merge NetBSD ftp from 20070722 to 20090520. Changes: - Only attempt to el_parse() a command unknown by the default parser if editing is enabled. Fixes pr 38589. - Turn off the alarmtimer before resetting the SIGALRM handler back to SIG_DFL. Fixes pr 35630. - Add epsv6 and epsv to disable extended passive mode for ipv6 or both ipv4 and ipv6 respectively. This hack is due to our friends a Juniper Networks who break epsv in ipv6. Should be fixed in ScreenOS 6.2.X. - Improve parsing of chunked transfer chunks per RFC2616: - more stringent chunk-size parsing - ignore optional trailing ';chunk-ext' stuff, instead of barfing - detect EOF before final \r\n. - Use the service name to getaddrinfo() (along with the host name), so that features such as DNS Service Discovery have a better chance of working. Display the service name in various status & error messages. - Don't getservbyname() the :port component of a URL; RFC 3986 says it's just an unsigned number, not a service name. - Fix numerous WARNS=4 issues (-Wcast-qual -Wsign-compare). - Fix -Wshadow issues - Update copyrights - Remove clause 3 and 4 from TNF licenses - Rename HAVE_STRUCT_SOCKADDR_SA_LEN to HAVE_STRUCT_SOCKADDR_IN_SIN_LEN to accurately reflect the structure member being used. - Use AF_INET instead of AF_UNSPEC as the default family if !defined(INET6). * configure improvements: - Style tweaks. - Use AC_LANG_PROGRAM() instead of AC_LANG_SOURCE() - Add a check for strptime() requiring separators between conversions, and use our replacement one if it does. Sat Dec 20 15:28:24 UTC 2008 lukem * configure improvements: - Move IPv6 check from tnftp.h to configure.ac (as per tnftpd). - Rework option descriptions. - Highlight when tests are for a specific option. - Move configuration results to the end of the file. - Display $prefix in configure results. Fri Aug 15 03:03:36 UTC 2008 lukem * Add a "Configuration results" display at the end of configure. Cosmetic tweaks. Fri Feb 29 09:45:56 UTC 2008 lukem * Support @EXEEXT@ for Cygwin (etc).
-rw-r--r--net/tnftp/files/src/cmdtab.c24
-rw-r--r--net/tnftp/files/src/complete.c44
-rw-r--r--net/tnftp/files/src/ftp.1239
-rw-r--r--net/tnftp/files/src/ftp_var.h45
4 files changed, 153 insertions, 199 deletions
diff --git a/net/tnftp/files/src/cmdtab.c b/net/tnftp/files/src/cmdtab.c
index 756088f9962..5c127cf595a 100644
--- a/net/tnftp/files/src/cmdtab.c
+++ b/net/tnftp/files/src/cmdtab.c
@@ -1,8 +1,8 @@
-/* $NetBSD: cmdtab.c,v 1.1.1.5 2007/08/06 04:33:23 lukem Exp $ */
-/* from NetBSD: cmdtab.c,v 1.47 2007/04/11 04:40:19 lukem Exp */
+/* $NetBSD: cmdtab.c,v 1.1.1.6 2014/10/31 18:47:19 spz Exp $ */
+/* from NetBSD: cmdtab.c,v 1.52 2012/12/22 16:57:09 christos Exp */
/*-
- * Copyright (c) 1996-2005 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -16,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -75,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)cmdtab.c 8.4 (Berkeley) 10/9/94";
#else
-__RCSID(" NetBSD: cmdtab.c,v 1.47 2007/04/11 04:40:19 lukem Exp ");
+__RCSID(" NetBSD: cmdtab.c,v 1.52 2012/12/22 16:57:09 christos Exp ");
#endif
#endif /* not lint */
@@ -108,7 +101,9 @@ HSTR deletehelp[] = "delete remote file";
HSTR disconhelp[] = "terminate ftp session";
HSTR domachelp[] = "execute macro";
HSTR edithelp[] = "toggle command line editing";
+HSTR epsvhelp[] = "toggle use of EPSV/EPRT on both IPv4 and IPV6 ftp";
HSTR epsv4help[] = "toggle use of EPSV/EPRT on IPv4 ftp";
+HSTR epsv6help[] = "toggle use of EPSV/EPRT on IPv6 ftp";
HSTR feathelp[] = "show FEATures supported by remote system";
HSTR formhelp[] = "set file transfer format";
HSTR gatehelp[] = "toggle gate-ftp; specify host[:port] to change proxy";
@@ -219,7 +214,9 @@ struct cmd cmdtab[] = {
{ "dir", H(lshelp), 1, 1, 1, CMPL(rl) ls },
{ "disconnect", H(disconhelp), 0, 1, 1, CMPL0 disconnect },
{ "edit", H(edithelp), 0, 0, 0, CMPL0 setedit },
+ { "epsv", H(epsvhelp), 0, 0, 0, CMPL0 setepsv },
{ "epsv4", H(epsv4help), 0, 0, 0, CMPL0 setepsv4 },
+ { "epsv6", H(epsv6help), 0, 0, 0, CMPL0 setepsv6 },
{ "exit", H(quithelp), 0, 0, 0, CMPL0 quit },
{ "features", H(feathelp), 0, 1, 1, CMPL0 feat },
{ "fget", H(fgethelp), 1, 1, 1, CMPL(l) fget },
@@ -302,16 +299,17 @@ struct cmd cmdtab[] = {
{ "verbose", H(verbosehelp), 0, 0, 0, CMPL0 setverbose },
{ "xferbuf", H(xferbufhelp), 0, 0, 0, CMPL0 setxferbuf },
{ "?", H(helphelp), 0, 0, 1, CMPL(C) help },
- { 0 },
+ { NULL, NULL, 0, 0, 0, CMPL0 NULL },
};
struct option optiontab[] = {
{ "anonpass", NULL },
{ "ftp_proxy", NULL },
{ "http_proxy", NULL },
+ { "https_proxy",NULL },
{ "no_proxy", NULL },
{ "pager", NULL },
{ "prompt", NULL },
{ "rprompt", NULL },
- { 0 },
+ { NULL, NULL },
};
diff --git a/net/tnftp/files/src/complete.c b/net/tnftp/files/src/complete.c
index ee0ecef6769..ec78589f642 100644
--- a/net/tnftp/files/src/complete.c
+++ b/net/tnftp/files/src/complete.c
@@ -1,8 +1,8 @@
-/* $NetBSD: complete.c,v 1.1.1.4 2007/08/06 04:33:23 lukem Exp $ */
-/* from NetBSD: complete.c,v 1.42 2007/04/17 05:52:03 lukem Exp */
+/* $NetBSD: complete.c,v 1.1.1.5 2014/10/31 18:47:19 spz Exp $ */
+/* from NetBSD: complete.c,v 1.46 2009/04/12 10:18:52 lukem Exp */
/*-
- * Copyright (c) 1997-2000,2005 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -16,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -43,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID(" NetBSD: complete.c,v 1.42 2007/04/17 05:52:03 lukem Exp ");
+__RCSID(" NetBSD: complete.c,v 1.46 2009/04/12 10:18:52 lukem Exp ");
#endif /* not lint */
/*
@@ -94,7 +87,7 @@ complete_ambiguous(char *word, int list, StringList *words)
{
char insertstr[MAXPATHLEN];
char *lastmatch, *p;
- int i, j;
+ size_t i, j;
size_t matchlen, wordlen;
wordlen = strlen(word);
@@ -157,7 +150,7 @@ complete_command(char *word, int list)
if (wordlen > strlen(c->c_name))
continue;
if (strncmp(word, c->c_name, wordlen) == 0)
- ftp_sl_add(words, c->c_name);
+ ftp_sl_add(words, ftp_strdup(c->c_name));
}
rv = complete_ambiguous(word, list, words);
@@ -165,7 +158,7 @@ complete_command(char *word, int list)
if (el_insertstr(el, " ") == -1)
rv = CC_ERROR;
}
- sl_free(words, 0);
+ sl_free(words, 1);
return (rv);
}
@@ -269,7 +262,7 @@ complete_option(char *word, int list)
if (wordlen > strlen(o->name))
continue;
if (strncmp(word, o->name, wordlen) == 0)
- ftp_sl_add(words, o->name);
+ ftp_sl_add(words, ftp_strdup(o->name));
}
rv = complete_ambiguous(word, list, words);
@@ -277,7 +270,7 @@ complete_option(char *word, int list)
if (el_insertstr(el, " ") == -1)
rv = CC_ERROR;
}
- sl_free(words, 0);
+ sl_free(words, 1);
return (rv);
}
@@ -292,10 +285,13 @@ complete_remote(char *word, int list)
StringList *words;
char dir[MAXPATHLEN];
char *file, *cp;
- int i;
+ size_t i;
unsigned char rv;
+ char cmdbuf[MAX_C_NAME];
+ char *dummyargv[3] = { NULL, NULL, NULL };
- char *dummyargv[] = { "complete", NULL, NULL };
+ (void)strlcpy(cmdbuf, "complete", sizeof(cmdbuf));
+ dummyargv[0] = cmdbuf;
dummyargv[1] = dir;
if ((file = strrchr(word, '/')) == NULL) {
@@ -361,17 +357,17 @@ complete_remote(char *word, int list)
* Generic complete routine
*/
unsigned char
-complete(EditLine *el, int ch)
+complete(EditLine *cel, int ch)
{
static char word[FTPBUFLEN];
- static int lastc_argc, lastc_argo;
+ static size_t lastc_argc, lastc_argo;
struct cmd *c;
const LineInfo *lf;
- int celems, dolist, cmpltype;
- size_t len;
+ int dolist, cmpltype;
+ size_t celems, len;
- lf = el_line(el);
+ lf = el_line(cel);
len = lf->lastchar - lf->buffer;
if (len >= sizeof(line))
return (CC_ERROR);
@@ -390,7 +386,7 @@ complete(EditLine *el, int ch)
&& strncmp(word, margv[cursor_argc] ? margv[cursor_argc] : "",
cursor_argo) == 0)
dolist = 1;
- else if (cursor_argc < margc)
+ else if (cursor_argc < (size_t)margc)
(void)strlcpy(word, margv[cursor_argc], cursor_argo + 1);
word[cursor_argo] = '\0';
diff --git a/net/tnftp/files/src/ftp.1 b/net/tnftp/files/src/ftp.1
index 5737a3defec..5bd1f2bdea3 100644
--- a/net/tnftp/files/src/ftp.1
+++ b/net/tnftp/files/src/ftp.1
@@ -1,7 +1,7 @@
-.\" $NetBSD: ftp.1,v 1.1.1.4 2007/08/06 04:33:23 lukem Exp $
-.\" from NetBSD: ftp.1,v 1.119 2007/07/18 06:40:01 lukem Exp
+.\" $NetBSD: ftp.1,v 1.1.1.5 2014/10/31 18:47:19 spz Exp $
+.\" from NetBSD: ftp.1,v 1.134 2012/12/22 16:57:10 christos Exp
.\"
-.\" Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1996-2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
@@ -15,13 +15,6 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the NetBSD
-.\" Foundation, Inc. and its contributors.
-.\" 4. Neither the name of The NetBSD Foundation nor the names of its
-.\" contributors may be used to endorse or promote products derived
-.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -65,32 +58,21 @@
.\"
.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
.\"
-.Dd July 18, 2007
+.Dd December 22, 2012
.Dt FTP 1
.Os
.Sh NAME
.Nm ftp
-.Nd
-Internet file transfer program
+.Nd Internet file transfer program
.Sh SYNOPSIS
.Nm
-.Op Fl 46AadefginpRtvV
-.Bk -words
+.Op Fl 46AadefginpRtVv
.Op Fl N Ar netrc
-.Ek
-.Bk -words
.Op Fl o Ar output
-.Ek
-.Bk -words
.Op Fl P Ar port
-.Ek
-.Bk -words
.Op Fl q Ar quittime
-.Ek
-.Op Fl s Ar srcaddr
-.Bk -words
.Op Fl r Ar retry
-.Ek
+.Op Fl s Ar srcaddr
.Bk -words
.\" [-T dir,max[,inc]]
.Oo
@@ -221,6 +203,14 @@ Disables file name globbing.
.It Fl i
Turns off interactive prompting during
multiple file transfers.
+.It Fl N Ar netrc
+Use
+.Ar netrc
+instead of
+.Pa ~/.netrc .
+Refer to
+.Sx THE .netrc FILE
+for more information.
.It Fl n
Restrains
.Nm
@@ -240,14 +230,6 @@ identity on the local machine), and, if necessary, prompt for a password
and an account with which to login.
To override the auto-login for auto-fetch transfers, specify the
username (and optionally, password) as appropriate.
-.It Fl N Ar netrc
-Use
-.Ar netrc
-instead of
-.Pa ~/.netrc .
-Refer to
-.Sx THE .netrc FILE
-for more information.
.It Fl o Ar output
When auto-fetching files, save the contents in
.Ar output .
@@ -265,39 +247,32 @@ then only the first file specified will be retrieved into
.Ar output ;
all other files will be retrieved into the basename of their
remote name.
+.It Fl P Ar port
+Sets the port number to
+.Ar port .
.It Fl p
Enable passive mode operation for use behind connection filtering firewalls.
This option has been deprecated as
.Nm
now tries to use passive mode by default, falling back to active mode
if the server does not support passive connections.
-.It Fl P Ar port
-Sets the port number to
-.Ar port .
.It Fl q Ar quittime
Quit if the connection has stalled for
.Ar quittime
seconds.
+.It Fl R
+Restart all non-proxied auto-fetches.
.It Fl r Ar wait
Retry the connection attempt if it failed, pausing for
.Ar wait
seconds.
-.It Fl R
-Restart all non-proxied auto-fetches.
.It Fl s Ar srcaddr
Uses
.Ar srcaddr
as the local IP address for all connections.
.It Fl t
Enables packet tracing.
-.It Xo
-.Fl T
-.Sm off
-.Ar direction ,
-.Ar maximum
-.Op , Ar increment
-.Sm on
-.Xc
+.It Fl T Ar direction Ns , Ns Ar maximum Ns Oo , Ns Ar increment Oc
Set the maximum transfer rate for
.Ar direction
to
@@ -318,6 +293,12 @@ is one of the ftp URL types as supported by auto-fetch
(with an optional target filename for single file uploads), and
.Ar file
is one or more local files to be uploaded.
+.It Fl V
+Disable
+.Ic verbose
+and
+.Ic progress ,
+overriding the default of enabled when output is to a terminal.
.It Fl v
Enable
.Ic verbose
@@ -331,12 +312,6 @@ Forces
.Nm
to show all responses from the remote server, as well
as report on data transfer statistics.
-.It Fl V
-Disable
-.Ic verbose
-and
-.Ic progress ,
-overriding the default of enabled when output is to a terminal.
.El
.Pp
The client host with which
@@ -461,16 +436,6 @@ when an ascii type transfer is made, these linefeeds may be
distinguished from a record delimiter only when
.Ic \&cr
is off.
-.It Ic ftp_debug Op Ar ftp_debug-value
-Toggle debugging mode.
-If an optional
-.Ar ftp_debug-value
-is specified it is used to set the debugging level.
-When debugging is on,
-.Nm
-prints each command sent to the remote machine, preceded
-by the string
-.Ql \-\-\*[Gt]
.It Ic delete Ar remote-file
Delete the file
.Ar remote-file
@@ -506,12 +471,13 @@ Toggle command line editing, and context sensitive command and file
completion.
This is automatically enabled if input is from a terminal, and
disabled otherwise.
-.It Ic epsv4
+.It Ic epsv epsv4 epsv6
Toggle the use of the extended
.Dv EPSV
and
.Dv EPRT
-commands on IPv4 connections; first try
+commands on all IP, IPv4, and IPv6 connections respectively.
+First try
.Dv EPSV /
.Dv EPRT ,
and then
@@ -520,7 +486,10 @@ and then
This is enabled by default.
If an extended command fails then this option will be temporarily
disabled for the duration of the current connection, or until
-.Ic epsv4
+.Ic epsv ,
+.Ic epsv4 ,
+or
+.Ic epsv6
is executed again.
.It Ic exit
A synonym for
@@ -544,6 +513,16 @@ format is
.It Ic ftp Ar host Op Ar port
A synonym for
.Ic open .
+.It Ic ftp_debug Op Ar ftp_debug-value
+Toggle debugging mode.
+If an optional
+.Ar ftp_debug-value
+is specified it is used to set the debugging level.
+When debugging is on,
+.Nm
+prints each command sent to the remote machine, preceded
+by the string
+.Ql \-\-\*[Gt] .
.It Ic gate Op Ar host Op Ar port
Toggle gate-ftp mode, which used to connect through the
TIS FWTK and Gauntlet ftp proxies.
@@ -789,7 +768,7 @@ mode is
.Dq stream .
.It Ic modtime Ar remote-file
Show the last modification time of the file on the remote machine, in
-.Li RFC2822
+.Li RFC 2822
format.
.It Ic more Ar file
A synonym for
@@ -1010,7 +989,7 @@ traffic.
servers are required to support the
.Dv PASV
command by
-.Li RFC1123 ,
+.Li RFC 1123 ,
some do not.)
.It Ic pdir Op Ar remote-path
Perform
@@ -1158,10 +1137,7 @@ A synonym for
The arguments specified are sent, verbatim, to the remote
.Tn FTP
server.
-.It Xo
-.Ic rate Ar direction
-.Op Ar maximum Op Ar increment
-.Xc
+.It Ic rate Ar direction Oo Ar maximum Oo Ar increment Oc Oc
Throttle the maximum transfer rate to
.Ar maximum
bytes/second.
@@ -1184,7 +1160,6 @@ Outgoing transfers.
can be modified on the fly by
.Ar increment
bytes (default: 1024) each time a given signal is received:
-.B
.Bl -tag -width "SIGUSR1" -offset indent
.It Dv SIGUSR1
Increment
@@ -1351,7 +1326,7 @@ and
.Ar value
are not given, display all of the options and their values.
The currently supported options are:
-.Bl -tag -width "http_proxy" -offset indent
+.Bl -tag -width "https_proxy" -offset indent
.It Cm anonpass
Defaults to
.Ev $FTPANONPASS
@@ -1361,6 +1336,9 @@ Defaults to
.It Cm http_proxy
Defaults to
.Ev $http_proxy .
+.It Cm https_proxy
+Defaults to
+.Ev $https_proxy .
.It Cm no_proxy
Defaults to
.Ev $no_proxy .
@@ -1446,10 +1424,7 @@ for more information.
.It Ic usage Ar command
Print the usage message for
.Ar command .
-.It Xo
-.Ic user Ar user-name
-.Op Ar password Op Ar account
-.Xc
+.It Ic user Ar user-name Oo Ar password Oo Ar account Oc Oc
Identify yourself to the remote
.Tn FTP
server.
@@ -1551,14 +1526,8 @@ on the command line.
The following formats are valid syntax for an auto-fetch element:
.Bl -tag -width "FOO "
.\" [user@]host:[path][/]
-.It Xo
-.Sm off
-.Op Ar user Li \&@
-.Ar host Li \&:
-.Op Ar path
-.Op Li /
-.Sm on
-.Xc
+.It Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Li \&: Ns Oo Ar path Oc \
+Ns Oo Li / Oc
.Dq Classic
.Tn FTP
format.
@@ -1583,18 +1552,9 @@ in the current directory.
Otherwise, the full remote name is used as the local name,
relative to the local root directory.
.\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
-.It Xo
-.Sm off
-.Li ftp://
-.Oo Ar user
-.Op Li \&: Ar password
-.Li \&@ Oc
-.Ar host Oo Li \&: Ar port Oc
-.Li / Ar path
-.Op Li /
-.Op Li ;type= Ar X
-.Sm on
-.Xc
+.It Li ftp:// Ns Oo Ar user Ns Oo Ns Li \&: Ns Ar password Oc Ns Li \&@ Oc \
+Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path Ns Oo Li / Oc \
+Ns Oo Li ;type= Ns Ar X Oc
An
.Tn FTP
URL, retrieved using the
@@ -1625,7 +1585,7 @@ ascii or binary (respectively).
The default transfer type is binary.
.Pp
In order to be compliant with
-.Li RFC3986 ,
+.Li RFC 3986 ,
.Nm
interprets the
.Ar path
@@ -1678,7 +1638,7 @@ Any
.Sq Li \&% Ns Ar XX
codes
(per
-.Li RFC3986 )
+.Li RFC 3986 )
within the path components are decoded, with
.Ar XX
representing a character code in hexadecimal.
@@ -1765,16 +1725,8 @@ intermediate directories that is used in the equivalent of a
command.
.El
.\" http://[user[:password]@]host[:port]/path
-.It Xo
-.Sm off
-.Li http://
-.Oo Ar user
-.Op Li \&: Ar password
-.Li \&@ Oc
-.Ar host Oo Li \&: Ar port Oc
-.Li / Ar path
-.Sm on
-.Xc
+.It Li http:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
+Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
An
.Tn HTTP
URL, retrieved using the
@@ -1794,22 +1746,36 @@ and
(and optionally
.Sq password )
is in the URL, use them for the first attempt to authenticate.
+.\" https://[user[:password]@]host[:port]/path
+.It Li https:// Ns Oo Ar user Ns Oo Li \&: Ns Ar password Oc Ns Li \&@ Oc \
+Ns Ar host Ns Oo Li \&: Ns Ar port Oc Ns Li / Ns Ar path
+An
+.Tn HTTPS
+URL, retrieved using the
+.Tn HTTPS
+protocol.
+If
+.Ic "set https_proxy"
+is defined, it is used as a URL to an
+.Tn HTTPS
+proxy server.
+If
+.Tn HTTPS
+authorization is required to retrieve
+.Ar path ,
+and
+.Sq user
+(and optionally
+.Sq password )
+is in the URL, use them for the first attempt to authenticate.
+There is currently no certificate validation and verification.
.\" file:///path
-.It Xo
-.Sm off
-.Li file:/// Ar path
-.Sm on
-.Xc
+.It Li file:/// Ns Ar path
A local URL, copied from
.Pa / Ns Ar path
on the local host.
.\" about:
-.It Xo
-.Sm off
-.Li about:
-.Ar topic
-.Sm on
-.Xc
+.It Li about: Ns Ar topic
Display information regarding
.Ar topic ;
no file is retrieved for this auto-fetched element.
@@ -1952,7 +1918,7 @@ Failing the above checks, if
.Dq globbing
is enabled, local file names are expanded according to the rules
used in the
-.Xr csh 1 ;
+.Xr csh 1 ;
see the
.Ic glob
command.
@@ -2128,7 +2094,7 @@ is applicable only to the
definition preceding it.
A
.Ic macdef
-entry cannot be utilized by multiple
+entry cannot be used by multiple
.Ic machine
definitions; rather, it must be defined following each
.Ic machine
@@ -2195,14 +2161,7 @@ information:
.It Li \&%/
The current remote working directory.
.\" %c[[0]n], %.[[0]n]
-.It Xo
-.Sm off
-.Li \&%c
-.Op Oo Li 0 Oc Ar n Ns ,
-.Li \&%.
-.Op Oo Li 0 Oc Ar n
-.Sm on
-.Xc
+.It \&%c Ns Oo Oo Li 0 Oc Ns Ar n Oc , Ns Li \&%. Ns Oo Oo Li 0 Oc Ns Ar n Oc
The trailing component of the current remote working directory, or
.Em n
trailing components if a digit
@@ -2343,7 +2302,7 @@ URL characters are required in the username or password
or
.Sq / ) ,
encode them with
-.Li RFC3986
+.Li RFC 3986
.Sq Li \&% Ns Ar XX
encoding.
.Pp
@@ -2388,23 +2347,23 @@ for an example of how to make this automatic.
.Nm
attempts to be compliant with:
.Bl -tag -offset indent -width 8n
-.It Li RFC0959
+.It Li RFC 959
.Em File Transfer Protocol
-.It Li RFC1123
+.It Li RFC 1123
.Em Requirements for Internet Hosts - Application and Support
-.It Li RFC1635
+.It Li RFC 1635
.Em How to Use Anonymous FTP
-.It Li RFC2389
+.It Li RFC 2389
.Em Feature negotiation mechanism for the File Transfer Protocol
-.It Li RFC2428
+.It Li RFC 2428
.Em FTP Extensions for IPv6 and NATs
-.It Li RFC2616
+.It Li RFC 2616
.Em Hypertext Transfer Protocol -- HTTP/1.1
-.It Li RFC2822
+.It Li RFC 2822
.Em Internet Message Format
-.It Li RFC3659
+.It Li RFC 3659
.Em Extensions to FTP
-.It Li RFC3986
+.It Li RFC 3986
.Em Uniform Resource Identifier (URI)
.El
.Sh HISTORY
diff --git a/net/tnftp/files/src/ftp_var.h b/net/tnftp/files/src/ftp_var.h
index 78bc26159ca..1286997c97e 100644
--- a/net/tnftp/files/src/ftp_var.h
+++ b/net/tnftp/files/src/ftp_var.h
@@ -1,8 +1,8 @@
-/* $NetBSD: ftp_var.h,v 1.1.1.4 2007/08/06 04:33:23 lukem Exp $ */
-/* from NetBSD: ftp_var.h,v 1.75 2007/07/22 05:02:50 lukem Exp */
+/* $NetBSD: ftp_var.h,v 1.1.1.5 2014/10/31 18:47:19 spz Exp $ */
+/* from NetBSD: ftp_var.h,v 1.82 2012/12/21 18:07:36 christos Exp */
/*-
- * Copyright (c) 1996-2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -16,13 +16,6 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -133,7 +126,7 @@
* Format of command table.
*/
struct cmd {
- char *c_name; /* name of command */
+ const char *c_name; /* name of command */
const char *c_help; /* help string */
char c_bell; /* give bell when command completes */
char c_conn; /* must be connected to use command */
@@ -144,6 +137,8 @@ struct cmd {
void (*c_handler)(int, char **); /* function to call */
};
+#define MAX_C_NAME 12 /* maximum length of cmd.c_name */
+
/*
* Format of macro table
*/
@@ -157,8 +152,8 @@ struct macel {
* Format of option table
*/
struct option {
- char *name;
- char *value;
+ const char *name;
+ char *value;
};
/*
@@ -187,6 +182,7 @@ enum {
#define FTP_PORT 21 /* default if ! getservbyname("ftp/tcp") */
#define HTTP_PORT 80 /* default if ! getservbyname("http/tcp") */
+#define HTTPS_PORT 443 /* default if ! getservbyname("https/tcp") */
#ifndef GATE_PORT
#define GATE_PORT 21 /* default if ! getservbyname("ftpgate/tcp") */
#endif
@@ -222,7 +218,7 @@ GLOBAL int autologin; /* establish user account on connection */
GLOBAL int proxy; /* proxy server connection active */
GLOBAL int proxflag; /* proxy connection exists */
GLOBAL int gatemode; /* use gate-ftp */
-GLOBAL char *gateserver; /* server to use for gate-ftp */
+GLOBAL const char *gateserver; /* server to use for gate-ftp */
GLOBAL int sunique; /* store files on server with unique name */
GLOBAL int runique; /* store local files with unique name */
GLOBAL int mcase; /* map upper to lower case for mget names */
@@ -257,9 +253,11 @@ GLOBAL int rate_get_incr; /* increment for get xfer rate */
GLOBAL int rate_put; /* maximum put xfer rate */
GLOBAL int rate_put_incr; /* increment for put xfer rate */
GLOBAL int retry_connect; /* seconds between retrying connection */
-GLOBAL char *tmpdir; /* temporary directory */
+GLOBAL const char *tmpdir; /* temporary directory */
GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */
GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
+GLOBAL int epsv6; /* use EPSV/EPRT on IPv6 connections */
+GLOBAL int epsv6bad; /* EPSV doesn't work on the current server */
GLOBAL int editing; /* command line editing enabled */
GLOBAL int features[FEAT_max]; /* remote FEATures supported */
@@ -271,8 +269,6 @@ GLOBAL size_t cursor_argc; /* location of cursor in margv */
GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
#endif /* !NO_EDITCOMPLETE */
-GLOBAL char *direction; /* direction transfer is occurring */
-
GLOBAL char *hostname; /* name of host connected to */
GLOBAL int unix_server; /* server is unix, can use binary for ascii */
GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */
@@ -281,9 +277,12 @@ GLOBAL char remotecwd[MAXPATHLEN]; /* remote dir */
GLOBAL char *username; /* name of user logged in as. (dynamic) */
GLOBAL sa_family_t family; /* address family to use for connections */
-GLOBAL char *ftpport; /* port number to use for FTP connections */
-GLOBAL char *httpport; /* port number to use for HTTP connections */
-GLOBAL char *gateport; /* port number to use for gateftp connections */
+GLOBAL const char *ftpport; /* port number to use for FTP connections */
+GLOBAL const char *httpport; /* port number to use for HTTP connections */
+#ifdef WITH_SSL
+GLOBAL const char *httpsport; /* port number to use for HTTPS connections */
+#endif
+GLOBAL const char *gateport; /* port number to use for gateftp connections */
GLOBAL struct addrinfo *bindai; /* local address to bind as */
GLOBAL char *outfile; /* filename to output URLs to */
@@ -333,7 +332,7 @@ extern struct option optiontab[];
#define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
#ifdef BSD4_4
-# define HAVE_STRUCT_SOCKADDR_SA_LEN 1
+# define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1
#endif
#ifdef NO_LONG_LONG
@@ -347,9 +346,11 @@ extern struct option optiontab[];
#define DWARN(...)
#else
#define DPRINTF(...) if (ftp_debug) (void)fprintf(ttyout, __VA_ARGS__)
-#define DWARN(...) if (ftp_debug) warn(__VA_ARGS__)
+#define DWARN(...) if (ftp_debug) warn(__VA_ARGS__)
#endif
+#define STRorNULL(s) ((s) ? (s) : "<null>")
+
#ifdef NO_USAGE
void xusage(void);
#define UPRINTF(...) xusage()