summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspz <spz@pkgsrc.org>2014-10-31 18:47:20 +0000
committerspz <spz@pkgsrc.org>2014-10-31 18:47:20 +0000
commitc8f5c8954be572ad63a389c233ad5190b07d89f4 (patch)
tree84d0ee7ea6182328b47b368e870676a3e4fa911a
parent09ec34543411c13c78fc58b3c44005609306420d (diff)
downloadpkgsrc-c8f5c8954be572ad63a389c233ad5190b07d89f4.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/libnetbsd/sl_init.c9
-rw-r--r--net/tnftp/files/libnetbsd/strptime.c9
-rw-r--r--net/tnftp/files/libnetbsd/strvis.c9
-rw-r--r--net/tnftp/files/libnetbsd/utimes.c9
-rw-r--r--net/tnftp/files/src/main.c159
5 files changed, 75 insertions, 120 deletions
diff --git a/net/tnftp/files/libnetbsd/sl_init.c b/net/tnftp/files/libnetbsd/sl_init.c
index 6757a0d7df8..3d4f45c753b 100644
--- a/net/tnftp/files/libnetbsd/sl_init.c
+++ b/net/tnftp/files/libnetbsd/sl_init.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sl_init.c,v 1.1.1.4 2005/06/10 06:37:47 lukem Exp $ */
+/* $NetBSD: sl_init.c,v 1.1.1.5 2014/10/31 18:47:20 spz Exp $ */
/* from NetBSD: stringlist.c,v 1.10 2000/01/25 16:24:40 enami Exp */
/*-
@@ -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
diff --git a/net/tnftp/files/libnetbsd/strptime.c b/net/tnftp/files/libnetbsd/strptime.c
index 88a32b081eb..7a6423cad96 100644
--- a/net/tnftp/files/libnetbsd/strptime.c
+++ b/net/tnftp/files/libnetbsd/strptime.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strptime.c,v 1.1.1.3 2006/10/26 07:24:14 lukem Exp $ */
+/* $NetBSD: strptime.c,v 1.1.1.4 2014/10/31 18:47:20 spz Exp $ */
/* from NetBSD: strptime.c,v 1.18 1999/04/29 02:58:30 tv Exp */
/*-
@@ -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
diff --git a/net/tnftp/files/libnetbsd/strvis.c b/net/tnftp/files/libnetbsd/strvis.c
index f7082c0dfde..41b212efd51 100644
--- a/net/tnftp/files/libnetbsd/strvis.c
+++ b/net/tnftp/files/libnetbsd/strvis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strvis.c,v 1.1.1.4 2005/06/10 11:48:49 lukem Exp $ */
+/* $NetBSD: strvis.c,v 1.1.1.5 2014/10/31 18:47:20 spz Exp $ */
/* from NetBSD: vis.c,v 1.33 2005/05/28 13:11:14 lukem Exp */
/*-
@@ -42,13 +42,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
diff --git a/net/tnftp/files/libnetbsd/utimes.c b/net/tnftp/files/libnetbsd/utimes.c
index dd1843fe0af..0c1ea005722 100644
--- a/net/tnftp/files/libnetbsd/utimes.c
+++ b/net/tnftp/files/libnetbsd/utimes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: utimes.c,v 1.1.1.2 2005/05/11 09:01:56 lukem Exp $ */
+/* $NetBSD: utimes.c,v 1.1.1.3 2014/10/31 18:47:20 spz Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -12,13 +12,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
diff --git a/net/tnftp/files/src/main.c b/net/tnftp/files/src/main.c
index 704cc8ed9d3..fb5a66b6dca 100644
--- a/net/tnftp/files/src/main.c
+++ b/net/tnftp/files/src/main.c
@@ -1,8 +1,8 @@
-/* $NetBSD: main.c,v 1.1.1.6 2007/08/06 04:33:23 lukem Exp $ */
-/* from NetBSD: main.c,v 1.105 2007/05/22 05:16:48 lukem Exp */
+/* $NetBSD: main.c,v 1.1.1.7 2014/10/31 18:47:20 spz Exp $ */
+/* from NetBSD: main.c,v 1.122 2012/12/22 16:57:10 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
@@ -101,15 +94,16 @@
#include <sys/cdefs.h>
#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n");
+__COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\
+ The Regents of the University of California. All rights reserved.\
+ Copyright 1996-2008 The NetBSD Foundation, Inc. All rights reserved");
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID(" NetBSD: main.c,v 1.105 2007/05/22 05:16:48 lukem Exp ");
+__RCSID(" NetBSD: main.c,v 1.122 2012/12/22 16:57:10 christos Exp ");
#endif
#endif /* not lint */
@@ -139,32 +133,36 @@ __RCSID(" NetBSD: main.c,v 1.105 2007/05/22 05:16:48 lukem Exp ");
#define FTP_PROXY "ftp_proxy" /* env var with FTP proxy location */
#define HTTP_PROXY "http_proxy" /* env var with HTTP proxy location */
+#define HTTPS_PROXY "https_proxy" /* env var with HTTPS proxy location */
#define NO_PROXY "no_proxy" /* env var with list of non-proxied
* hosts, comma or space separated */
-static void setupoption(char *, char *, char *);
-int main(int, char *[]);
+__dead static void usage(void);
+static void setupoption(const char *, const char *, const char *);
int
main(int volatile argc, char **volatile argv)
{
int ch, rval;
struct passwd *pw;
- char *cp, *ep, *anonuser, *anonpass, *upload_path, *src_addr;
- int dumbterm, s, isupload;
+ char *cp, *ep, *anonpass, *upload_path, *src_addr;
+ const char *anonuser;
+ int dumbterm, isupload;
size_t len;
- socklen_t slen;
tzset();
-#if 0 /* tnftp */ /* XXX */
+#if defined(HAVE_SETLOCALE)
setlocale(LC_ALL, "");
-#endif /* tnftp */
+#endif
setprogname(argv[0]);
sigint_raised = 0;
ftpport = "ftp";
httpport = "http";
+#ifdef WITH_SSL
+ httpsport = "https";
+#endif
gateport = NULL;
cp = getenv("FTPSERVERPORT");
if (cp != NULL)
@@ -196,50 +194,28 @@ main(int volatile argc, char **volatile argv)
rate_put_incr = DEFAULTINCR;
#ifdef INET6
epsv4 = 1;
+ epsv6 = 1;
#else
epsv4 = 0;
+ epsv6 = 0;
#endif
epsv4bad = 0;
+ epsv6bad = 0;
src_addr = NULL;
upload_path = NULL;
isupload = 0;
reply_callback = NULL;
+#ifdef INET6
family = AF_UNSPEC;
+#else
+ family = AF_INET; /* force AF_INET if no INET6 support */
+#endif
netrc[0] = '\0';
cp = getenv("NETRC");
if (cp != NULL && strlcpy(netrc, cp, sizeof(netrc)) >= sizeof(netrc))
errx(1, "$NETRC `%s': %s", cp, strerror(ENAMETOOLONG));
- /*
- * Get the default socket buffer sizes if we don't already have them.
- * It doesn't matter which socket we do this to, because on the first
- * call no socket buffer sizes will have been modified, so we are
- * guaranteed to get the system defaults.
- */
- s = socket(AF_INET, SOCK_STREAM, 0);
- if (s == -1)
- err(1, "Can't create socket to determine default socket sizes");
- slen = sizeof(rcvbuf_size);
- if (getsockopt(s, SOL_SOCKET, SO_RCVBUF,
- (void *)&rcvbuf_size, &slen) == -1)
- err(1, "Unable to get default rcvbuf size");
- slen = sizeof(sndbuf_size);
- if (getsockopt(s, SOL_SOCKET, SO_SNDBUF,
- (void *)&sndbuf_size, &slen) == -1)
- err(1, "Unable to get default sndbuf size");
- (void)close(s);
- /* sanity check returned buffer sizes */
- if (rcvbuf_size <= 0)
- rcvbuf_size = 8 * 1024;
- if (sndbuf_size <= 0)
- sndbuf_size = 8 * 1024;
-
- if (sndbuf_size > 8 * 1024 * 1024)
- sndbuf_size = 8 * 1024 * 1024;
- if (rcvbuf_size > 8 * 1024 * 1024)
- rcvbuf_size = 8 * 1024 * 1024;
-
marg_sl = ftp_sl_init();
if ((tmpdir = getenv("TMPDIR")) == NULL)
tmpdir = _PATH_TMP;
@@ -399,10 +375,12 @@ main(int volatile argc, char **volatile argv)
{
int targc;
char *targv[6], *oac;
+ char cmdbuf[MAX_C_NAME];
/* look for `dir,max[,incr]' */
targc = 0;
- targv[targc++] = "-T";
+ (void)strlcpy(cmdbuf, "-T", sizeof(cmdbuf));
+ targv[targc++] = cmdbuf;
oac = ftp_strdup(optarg);
while ((cp = strsep(&oac, ",")) != NULL) {
@@ -520,6 +498,7 @@ main(int volatile argc, char **volatile argv)
setupoption("anonpass", getenv("FTPANONPASS"), anonpass);
setupoption("ftp_proxy", getenv(FTP_PROXY), "");
setupoption("http_proxy", getenv(HTTP_PROXY), "");
+ setupoption("https_proxy", getenv(HTTPS_PROXY), "");
setupoption("no_proxy", getenv(NO_PROXY), "");
setupoption("pager", getenv("PAGER"), DEFAULTPAGER);
setupoption("prompt", getenv("FTPPROMPT"), DEFAULTPROMPT);
@@ -551,22 +530,23 @@ main(int volatile argc, char **volatile argv)
if (rval >= 0) /* -1 == connected and cd-ed */
goto sigint_or_rval_exit;
} else {
- char *xargv[4], *user, *host;
+ char *xargv[4], *uuser, *host;
+ char cmdbuf[MAXPATHLEN];
if ((rval = sigsetjmp(toplevel, 1)))
goto sigint_or_rval_exit;
(void)xsignal(SIGINT, intr);
(void)xsignal(SIGPIPE, lostpeer);
- user = NULL;
+ uuser = NULL;
host = argv[0];
cp = strchr(host, '@');
if (cp) {
*cp = '\0';
- user = host;
+ uuser = host;
host = cp + 1;
}
- /* XXX discards const */
- xargv[0] = (char *)getprogname();
+ (void)strlcpy(cmdbuf, getprogname(), sizeof(cmdbuf));
+ xargv[0] = cmdbuf;
xargv[1] = host;
xargv[2] = argv[1];
xargv[3] = NULL;
@@ -574,14 +554,14 @@ main(int volatile argc, char **volatile argv)
int oautologin;
oautologin = autologin;
- if (user != NULL) {
+ if (uuser != NULL) {
anonftp = 0;
autologin = 0;
}
setpeer(argc+1, xargv);
autologin = oautologin;
- if (connected == 1 && user != NULL)
- (void)ftp_login(host, user, NULL);
+ if (connected == 1 && uuser != NULL)
+ (void)ftp_login(host, uuser, NULL);
if (!retry_connect)
break;
if (!connected) {
@@ -615,18 +595,18 @@ main(int volatile argc, char **volatile argv)
char *
prompt(void)
{
- static char **prompt;
+ static char **promptopt;
static char buf[MAXPATHLEN];
- if (prompt == NULL) {
+ if (promptopt == NULL) {
struct option *o;
o = getoption("prompt");
if (o == NULL)
errx(1, "prompt: no such option `prompt'");
- prompt = &(o->value);
+ promptopt = &(o->value);
}
- formatbuf(buf, sizeof(buf), *prompt ? *prompt : DEFAULTPROMPT);
+ formatbuf(buf, sizeof(buf), *promptopt ? *promptopt : DEFAULTPROMPT);
return (buf);
}
@@ -636,18 +616,18 @@ prompt(void)
char *
rprompt(void)
{
- static char **rprompt;
+ static char **rpromptopt;
static char buf[MAXPATHLEN];
- if (rprompt == NULL) {
+ if (rpromptopt == NULL) {
struct option *o;
o = getoption("rprompt");
if (o == NULL)
errx(1, "rprompt: no such option `rprompt'");
- rprompt = &(o->value);
+ rpromptopt = &(o->value);
}
- formatbuf(buf, sizeof(buf), *rprompt ? *rprompt : DEFAULTRPROMPT);
+ formatbuf(buf, sizeof(buf), *rpromptopt ? *rpromptopt : DEFAULTRPROMPT);
return (buf);
}
@@ -661,8 +641,10 @@ cmdscanner(void)
char *p;
#ifndef NO_EDITCOMPLETE
int ch;
-#endif
size_t num;
+#endif
+ int len;
+ char cmdbuf[MAX_C_NAME];
for (;;) {
#ifndef NO_EDITCOMPLETE
@@ -675,8 +657,8 @@ cmdscanner(void)
fprintf(ttyout, "%s ", p);
}
(void)fflush(ttyout);
- num = getline(stdin, line, sizeof(line), NULL);
- switch (num) {
+ len = get_line(stdin, line, sizeof(line), NULL);
+ switch (len) {
case -1: /* EOF */
case -2: /* error */
if (fromatty)
@@ -738,7 +720,8 @@ cmdscanner(void)
* such commands as invalid.
*/
if (strchr(margv[0], ':') != NULL ||
- el_parse(el, margc, (const char **)margv) != 0)
+ !editing ||
+ el_parse(el, margc, (void *)margv) != 0)
#endif /* !NO_EDITCOMPLETE */
fputs("?Invalid command.\n", ttyout);
continue;
@@ -748,7 +731,8 @@ cmdscanner(void)
continue;
}
confirmrest = 0;
- margv[0] = c->c_name;
+ (void)strlcpy(cmdbuf, c->c_name, sizeof(cmdbuf));
+ margv[0] = cmdbuf;
(*c->c_handler)(margc, margv);
if (bell && c->c_bell)
(void)putc('\007', ttyout);
@@ -842,6 +826,8 @@ makeargv(void)
char *
slurpstring(void)
{
+ static char bangstr[2] = { '!', '\0' };
+ static char dollarstr[2] = { '$', '\0' };
int got_one = 0;
char *sb = stringbase;
char *ap = argbase;
@@ -852,7 +838,7 @@ slurpstring(void)
case 0:
slrflag++;
INC_CHKCURSOR(stringbase);
- return ((*sb == '!') ? "!" : "$");
+ return ((*sb == '!') ? bangstr : dollarstr);
/* NOTREACHED */
case 1:
slrflag++;
@@ -975,7 +961,8 @@ void
help(int argc, char *argv[])
{
struct cmd *c;
- char *nargv[1], *p, *cmd;
+ char *nargv[1], *cmd;
+ const char *p;
int isusage;
cmd = argv[0];
@@ -993,9 +980,9 @@ help(int argc, char *argv[])
proxy ? "Proxy c" : "C");
for (c = cmdtab; (p = c->c_name) != NULL; c++)
if (!proxy || c->c_proxy)
- ftp_sl_add(buf, p);
+ ftp_sl_add(buf, ftp_strdup(p));
list_vertical(buf);
- sl_free(buf, 0);
+ sl_free(buf, 1);
return;
}
@@ -1003,6 +990,7 @@ help(int argc, char *argv[])
while (--argc > 0) {
char *arg;
+ char cmdbuf[MAX_C_NAME];
arg = *++argv;
c = getcmd(arg);
@@ -1014,7 +1002,8 @@ help(int argc, char *argv[])
cmd, arg);
else {
if (isusage) {
- nargv[0] = c->c_name;
+ (void)strlcpy(cmdbuf, c->c_name, sizeof(cmdbuf));
+ nargv[0] = cmdbuf;
(*c->c_handler)(0, nargv);
} else
fprintf(ttyout, "%-*s\t%s\n", HELPINDENT,
@@ -1053,18 +1042,9 @@ getoptionvalue(const char *name)
}
static void
-setupoption(char *name, char *value, char *defaultvalue)
+setupoption(const char *name, const char *value, const char *defaultvalue)
{
- char *nargv[3];
- int overbose;
-
- nargv[0] = "setupoption()";
- nargv[1] = name;
- nargv[2] = (value ? value : defaultvalue);
- overbose = verbose;
- verbose = 0;
- setoption(3, nargv);
- verbose = overbose;
+ set_option(name, value ? value : defaultvalue, 0);
}
void
@@ -1073,11 +1053,14 @@ usage(void)
const char *progname = getprogname();
(void)fprintf(stderr,
-"usage: %s [-46AadefginpRtvV] [-N netrc] [-o outfile] [-P port] [-q quittime]\n"
+"usage: %s [-46AadefginpRtVv] [-N netrc] [-o outfile] [-P port] [-q quittime]\n"
" [-r retry] [-s srcaddr] [-T dir,max[,inc]]\n"
" [[user@]host [port]] [host:path[/]] [file:///file]\n"
" [ftp://[user[:pass]@]host[:port]/path[/]]\n"
" [http://[user[:pass]@]host[:port]/path] [...]\n"
+#ifdef WITH_SSL
+" [https://[user[:pass]@]host[:port]/path] [...]\n"
+#endif
" %s -u URL file [...]\n", progname, progname);
exit(1);
}