summaryrefslogtreecommitdiff
path: root/lib/libcurses
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-10-08 04:20:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-10-08 04:20:01 +0000
commit2c8f9425c46888116a6c19bb6d03b4b55edcfa59 (patch)
tree43db4bec7a5da12f74dd25a742c08d3b4ec9a209 /lib/libcurses
parent2d24a454d432191d40ad98981de3308269bb7d11 (diff)
Don't honor $TERMCAP, $TERMINFO, or ~/.termcap, ~/.terminfo if we are setuid/setgid
Diffstat (limited to 'lib/libcurses')
-rw-r--r--lib/libcurses/read_bsd_terminfo.c6
-rw-r--r--lib/libcurses/read_entry.c10
-rw-r--r--lib/libcurses/read_termcap.c8
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/libcurses/read_bsd_terminfo.c b/lib/libcurses/read_bsd_terminfo.c
index ccac575dcc2..091874f9a29 100644
--- a/lib/libcurses/read_bsd_terminfo.c
+++ b/lib/libcurses/read_bsd_terminfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_bsd_terminfo.c,v 1.4 1998/08/16 05:17:53 millert Exp $ */
+/* $OpenBSD: read_bsd_terminfo.c,v 1.5 1998/10/08 04:20:00 millert Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.4 1998/08/16 05:17:53 millert Exp $";
+static char rcsid[] = "$OpenBSD: read_bsd_terminfo.c,v 1.5 1998/10/08 04:20:00 millert Exp $";
#endif
#include <curses.priv.h>
@@ -73,7 +73,7 @@ _nc_read_bsd_terminfo_entry(tn, tp)
}
/* Also check $HOME/.terminfo if it exists */
- if ((p = getenv("HOME")) != NULL) {
+ if (!issetugid() && (p = getenv("HOME")) != NULL) {
len = snprintf(hometerm, sizeof(hometerm), "%s/.terminfo", p);
if (len < sizeof(hometerm))
*fname++ = hometerm;
diff --git a/lib/libcurses/read_entry.c b/lib/libcurses/read_entry.c
index ed44929ceae..eade3d7e604 100644
--- a/lib/libcurses/read_entry.c
+++ b/lib/libcurses/read_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_entry.c,v 1.3 1998/09/13 19:16:28 millert Exp $ */
+/* $OpenBSD: read_entry.c,v 1.4 1998/10/08 04:20:00 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -86,7 +86,7 @@ const char *_nc_tic_dir(const char *path)
have_tic_directory = TRUE;
} else if (!have_tic_directory) {
char *envp;
- if ((envp = getenv("TERMINFO")) != 0)
+ if (!issetugid() && (envp = getenv("TERMINFO")) != 0)
return _nc_tic_dir(envp);
}
return result;
@@ -303,12 +303,12 @@ char ttn[MAX_ALIAS + 3];
&& _nc_read_tic_entry(filename, _nc_tic_dir(0), ttn, tp) == 1)
return 1;
- if ((envp = getenv("TERMINFO")) != 0
+ if (!issetugid() && (envp = getenv("TERMINFO")) != 0
&& _nc_read_tic_entry(filename, _nc_tic_dir(envp), ttn, tp) == 1)
return 1;
/* this is an ncurses extension */
- if ((envp = getenv("HOME")) != 0 &&
+ if (!issetugid() && (envp = getenv("HOME")) != 0 &&
strlen(envp) + sizeof(PRIVATE_INFO) <= PATH_MAX)
{
char *home = malloc(strlen(envp) + sizeof(PRIVATE_INFO));
@@ -324,7 +324,7 @@ char ttn[MAX_ALIAS + 3];
}
/* this is an ncurses extension */
- if ((envp = getenv("TERMINFO_DIRS")) != 0)
+ if (!issetugid() && (envp = getenv("TERMINFO_DIRS")) != 0)
return _nc_read_terminfo_dirs(envp, filename, ttn, tp);
/* Try the system directory. Note that the TERMINFO_DIRS value, if
diff --git a/lib/libcurses/read_termcap.c b/lib/libcurses/read_termcap.c
index 64467f39dcc..bd6da55add1 100644
--- a/lib/libcurses/read_termcap.c
+++ b/lib/libcurses/read_termcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_termcap.c,v 1.4 1998/09/13 19:16:29 millert Exp $ */
+/* $OpenBSD: read_termcap.c,v 1.5 1998/10/08 04:20:00 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998 Free Software Foundation, Inc. *
@@ -802,7 +802,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name)
* searched instead. The path is found in the TERMPATH variable, or
* becomes "$HOME/.termcap /etc/termcap" if no TERMPATH exists.
*/
- if (!is_pathname(cp)) { /* no TERMCAP or it holds an entry */
+ if (!issetugid() && !is_pathname(cp)) { /* no TERMCAP or it holds an entry */
if ((termpath = getenv("TERMPATH")) != 0) {
strlcpy(pathbuf, termpath, PBUFSIZ);
} else {
@@ -971,7 +971,7 @@ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp)
char pathbuf[PATH_MAX];
termpaths[filecount] = 0;
- if ((tc = getenv("TERMCAP")) != 0)
+ if (!issetugid() && (tc = getenv("TERMCAP")) != 0)
{
if (is_pathname(tc)) /* interpret as a filename */
{
@@ -1012,7 +1012,7 @@ int _nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp)
else
ADD_TC("/usr/share/misc/termcap", filecount);
- if ((h = getenv("HOME")) != NULL && strlen(h) + 9 < PATH_MAX)
+ if (!issetugid() && (h = getenv("HOME")) != NULL && strlen(h) + 9 < PATH_MAX)
{
/* user's .termcap, if any, should override it */
(void) strcpy(envhome, h);