summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-03-31 23:04:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-03-31 23:04:08 +0000
commitaa3be9076a77ac87c5503d598b2ac53679418e66 (patch)
treee466f8191a54bbd519f0ad830a6397d974c505de
parentdf9c83489366e6518426547c5388edf5e374118a (diff)
Treat empty environment variables the same as NULL. henning@ OK
-rw-r--r--usr.bin/ftp/cmds.c6
-rw-r--r--usr.bin/ftp/fetch.c10
-rw-r--r--usr.bin/ftp/main.c10
-rw-r--r--usr.bin/ftp/ruserpass.c6
-rw-r--r--usr.bin/ftp/util.c6
5 files changed, 20 insertions, 18 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c
index b22908e3797..8b20f0971c4 100644
--- a/usr.bin/ftp/cmds.c
+++ b/usr.bin/ftp/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.42 2003/01/03 04:57:54 deraadt Exp $ */
+/* $OpenBSD: cmds.c,v 1.43 2003/03/31 23:04:07 millert Exp $ */
/* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */
/*
@@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: cmds.c,v 1.42 2003/01/03 04:57:54 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cmds.c,v 1.43 2003/03/31 23:04:07 millert Exp $";
#endif
#endif /* not lint */
@@ -1285,7 +1285,7 @@ shell(argc, argv)
(void)signal(SIGINT, SIG_DFL);
(void)signal(SIGQUIT, SIG_DFL);
shell = getenv("SHELL");
- if (shell == NULL)
+ if (shell == NULL || *shell == '\0')
shell = _PATH_BSHELL;
namep = strrchr(shell, '/');
if (namep == NULL)
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
index e7e805c2b3f..62a97c948d9 100644
--- a/usr.bin/ftp/fetch.c
+++ b/usr.bin/ftp/fetch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fetch.c,v 1.44 2003/03/10 06:20:10 itojun Exp $ */
+/* $OpenBSD: fetch.c,v 1.45 2003/03/31 23:04:07 millert Exp $ */
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/*-
@@ -38,7 +38,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: fetch.c,v 1.44 2003/03/10 06:20:10 itojun Exp $";
+static char rcsid[] = "$OpenBSD: fetch.c,v 1.45 2003/03/31 23:04:07 millert Exp $";
#endif /* not lint */
/*
@@ -630,8 +630,10 @@ auto_fetch(argc, argv, outfile)
(void)signal(SIGINT, (sig_t)intr);
(void)signal(SIGPIPE, (sig_t)lostpeer);
- ftpproxy = getenv(FTP_PROXY);
- httpproxy = getenv(HTTP_PROXY);
+ if ((ftpproxy = getenv(FTP_PROXY)) != NULL && *ftpproxy == '\0')
+ ftpproxy = NULL;
+ if ((httpproxy = getenv(HTTP_PROXY)) != NULL && *httpproxy == '\0')
+ httpproxy = NULL;
/*
* Loop through as long as there's files to fetch.
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index d2385a220b3..f37a385fe74 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.50 2002/06/04 10:13:23 mpech Exp $ */
+/* $OpenBSD: main.c,v 1.51 2003/03/31 23:04:07 millert Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -73,7 +73,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.50 2002/06/04 10:13:23 mpech Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.51 2003/03/31 23:04:07 millert Exp $";
#endif
#endif /* not lint */
@@ -111,7 +111,7 @@ main(argc, argv)
ftpport = "ftp";
httpport = "http";
gateport = getenv("FTPSERVERPORT");
- if (gateport == NULL)
+ if (gateport == NULL || *gateport == '\0')
gateport = "ftpgate";
doglob = 1;
interactive = 1;
@@ -137,7 +137,7 @@ main(argc, argv)
epsv4bad = 0;
/* Set default operation mode based on FTPMODE environment variable */
- if ((cp = getenv("FTPMODE")) != NULL) {
+ if ((cp = getenv("FTPMODE")) != NULL && *cp != '\0') {
if (strcmp(cp, "passive") == 0) {
passivemode = 1;
activefallback = 0;
@@ -167,7 +167,7 @@ main(argc, argv)
}
cp = getenv("TERM");
- dumb_terminal = (cp == NULL || !strcmp(cp, "dumb") ||
+ dumb_terminal = (cp == NULL || *cp == '\0' || !strcmp(cp, "dumb") ||
!strcmp(cp, "emacs") || !strcmp(cp, "su"));
fromatty = isatty(fileno(stdin));
if (fromatty) {
diff --git a/usr.bin/ftp/ruserpass.c b/usr.bin/ftp/ruserpass.c
index 88bc6333c93..0f310f70f0f 100644
--- a/usr.bin/ftp/ruserpass.c
+++ b/usr.bin/ftp/ruserpass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ruserpass.c,v 1.13 2002/02/16 21:27:46 millert Exp $ */
+/* $OpenBSD: ruserpass.c,v 1.14 2003/03/31 23:04:07 millert Exp $ */
/* $NetBSD: ruserpass.c,v 1.14 1997/07/20 09:46:01 lukem Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
#else
-static char rcsid[] = "$OpenBSD: ruserpass.c,v 1.13 2002/02/16 21:27:46 millert Exp $";
+static char rcsid[] = "$OpenBSD: ruserpass.c,v 1.14 2003/03/31 23:04:07 millert Exp $";
#endif
#endif /* not lint */
@@ -93,7 +93,7 @@ ruserpass(host, aname, apass, aacct)
struct stat stb;
hdir = getenv("HOME");
- if (hdir == NULL)
+ if (hdir == NULL || *hdir == '\0')
return (0);
if (strlen(hdir) + sizeof(".netrc") < sizeof(buf)) {
(void)sprintf(buf, "%s/.netrc", hdir);
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index ab5dfa03cf2..50574860317 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.31 2002/11/08 03:30:17 fgsch Exp $ */
+/* $OpenBSD: util.c,v 1.32 2003/03/31 23:04:07 millert Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*
@@ -35,7 +35,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.31 2002/11/08 03:30:17 fgsch Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.32 2003/03/31 23:04:07 millert Exp $";
#endif /* not lint */
/*
@@ -388,7 +388,7 @@ remglob(argv, doswitch, errbuf)
if (ftemp == NULL) {
int len;
- if ((cp = getenv("TMPDIR")) == NULL)
+ if ((cp = getenv("TMPDIR")) == NULL || *cp == '\0')
cp = _PATH_TMP;
len = strlen(cp);
if (len + sizeof(TMPFILE) + (cp[len-1] != '/') > sizeof(temp)) {