summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/db/btree/bt_open.c7
-rw-r--r--lib/libc/locale/setlocale.c5
-rw-r--r--lib/libc/nls/catopen.c14
-rw-r--r--lib/libedit/el.c4
-rw-r--r--lib/libpthread/stdio/tempnam.c4
5 files changed, 17 insertions, 17 deletions
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index 5cf95665d9b..fecc36c4000 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: bt_open.c,v 1.3 1996/08/19 08:20:07 tholo Exp $";
+static char rcsid[] = "$OpenBSD: bt_open.c,v 1.4 1996/08/26 00:17:14 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -388,10 +388,11 @@ tmp()
{
sigset_t set, oset;
int fd;
- char *envtmp;
+ char *envtmp = NULL;
char path[MAXPATHLEN];
- envtmp = getenv("TMPDIR");
+ if (issetugid() == 0)
+ envtmp = getenv("TMPDIR");
(void)snprintf(path,
sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : "/tmp");
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c
index 5f34ca19d10..a7ee9fe56c6 100644
--- a/lib/libc/locale/setlocale.c
+++ b/lib/libc/locale/setlocale.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: setlocale.c,v 1.2 1996/08/19 08:28:24 tholo Exp $";
+static char rcsid[] = "$OpenBSD: setlocale.c,v 1.3 1996/08/26 00:17:18 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/localedef.h>
@@ -91,7 +91,8 @@ setlocale(category, locale)
int found, i, len;
char *env, *r;
- if (!PathLocale && !(PathLocale = getenv("PATH_LOCALE")))
+ if (issetugid() != 0 ||
+ (!PathLocale && !(PathLocale = getenv("PATH_LOCALE"))))
PathLocale = _PATH_LOCALE;
if (category < 0 || category >= _LC_LAST)
diff --git a/lib/libc/nls/catopen.c b/lib/libc/nls/catopen.c
index 38b9abd36b9..28dd2f69408 100644
--- a/lib/libc/nls/catopen.c
+++ b/lib/libc/nls/catopen.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: catopen.c,v 1.5 1996/08/19 08:30:09 tholo Exp $";
+static char rcsid[] = "$OpenBSD: catopen.c,v 1.6 1996/08/26 00:17:20 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#define _NLS_PRIVATE
@@ -72,15 +72,13 @@ _catopen(name, oflag)
return (nl_catd) -1;
/* absolute or relative path? */
- if (strchr (name, '/'))
+ if (strchr(name, '/'))
return load_msgcat(name);
- if ((nlspath = getenv ("NLSPATH")) == NULL) {
+ if (issetugid() != 0 || (nlspath = getenv("NLSPATH")) == NULL)
nlspath = NLS_DEFAULT_PATH;
- }
- if ((lang = getenv ("LANG")) == NULL) {
+ if ((lang = getenv("LANG")) == NULL)
lang = NLS_DEFAULT_LANG;
- }
s = nlspath;
t = tmppath;
@@ -135,7 +133,7 @@ load_msgcat(path)
void *data;
int fd;
- if ((fd = open (path, O_RDONLY)) == -1)
+ if ((fd = open(path, O_RDONLY)) == -1)
return (nl_catd) -1;
if (fstat(fd, &st) != 0) {
@@ -156,7 +154,7 @@ load_msgcat(path)
return (nl_catd) -1;
}
- if ((catd = malloc (sizeof (*catd))) == 0) {
+ if ((catd = malloc(sizeof (*catd))) == 0) {
munmap(data, (size_t) st.st_size);
return (nl_catd) -1;
}
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 7314477a69a..6a71eb82b05 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -77,7 +77,7 @@ el_init(prog, fin, fout)
el->el_prog = strdup(prog);
#ifdef DEBUG
- if ((tty = getenv("DEBUGTTY")) != NULL) {
+ if (issetugid() == 0 && (tty = getenv("DEBUGTTY")) != NULL) {
el->el_errfile = fopen(tty, "w");
if (el->el_errfile == NULL) {
extern errno;
@@ -291,7 +291,7 @@ el_source(el, fname)
if (fname == NULL) {
fname = &elpath[1];
if ((fp = fopen(fname, "r")) == NULL) {
- if ((ptr = getenv("HOME")) == NULL)
+ if (issetugid() != 0 || (ptr = getenv("HOME")) == NULL)
return -1;
fname = strncpy(path, ptr, MAXPATHLEN);
(void) strncat(path, elpath, MAXPATHLEN);
diff --git a/lib/libpthread/stdio/tempnam.c b/lib/libpthread/stdio/tempnam.c
index 95ecfeb3a5a..e9c7e742472 100644
--- a/lib/libpthread/stdio/tempnam.c
+++ b/lib/libpthread/stdio/tempnam.c
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)tempnam.c 5.1 (Berkeley) 2/22/91";*/
-static char *rcsid = "$Id: tempnam.c,v 1.1 1995/10/18 08:43:09 deraadt Exp $";
+static char *rcsid = "$Id: tempnam.c,v 1.2 1996/08/26 00:17:28 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -56,7 +56,7 @@ tempnam(dir, pfx)
if (!pfx)
pfx = "tmp.";
- if (f = getenv("TMPDIR")) {
+ if (issetugid() == 0 && f = getenv("TMPDIR")) {
(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
*(f + strlen(f) - 1) == '/'? "": "/", pfx);
if (f = mktemp(name))