summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-25 10:11:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-25 10:11:12 +0000
commitdfedb08915b999cdcfec182173f93bcd5b869459 (patch)
tree546ef680aad37b9852bcdc7e4381c349cea453fb
parent613577d979b284a77180108564f913611abd91d9 (diff)
use issetugid()
-rw-r--r--lib/libc/net/res_init.c9
-rw-r--r--lib/libc/stdio/tempnam.c4
-rw-r--r--lib/libc/time/localtime.c4
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c
index 9992acb6329..c925236869e 100644
--- a/lib/libc/net/res_init.c
+++ b/lib/libc/net/res_init.c
@@ -52,7 +52,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: res_init.c,v 1.4 1996/08/19 08:29:45 tholo Exp $";
+static char rcsid[] = "$OpenBSD: res_init.c,v 1.5 1996/08/25 10:11:02 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -114,7 +114,6 @@ res_init()
int nsort = 0;
int dots;
u_long mask;
- int notsuid = (getuid() == geteuid());
_res.nsaddr.sin_len = sizeof(struct sockaddr_in);
_res.nsaddr.sin_family = AF_INET;
@@ -130,7 +129,7 @@ res_init()
strncpy(_res.lookups, "f", sizeof _res.lookups);
/* Allow user to override the local domain definition */
- if (notsuid && (cp = getenv("LOCALDOMAIN")) != NULL) {
+ if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) {
(void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL)
*cp = '\0';
@@ -334,7 +333,9 @@ res_init()
#endif
}
- if (notsuid && (cp = getenv("RES_OPTIONS")) != NULL)
+ if (issetugid())
+ _res.options |= RES_NOALIASES;
+ else if ((cp = getenv("RES_OPTIONS")) != NULL)
res_setoptions(cp, "env");
_res.options |= RES_INIT;
return (0);
diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c
index cc3c2e27186..5c7a8150955 100644
--- a/lib/libc/stdio/tempnam.c
+++ b/lib/libc/stdio/tempnam.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: tempnam.c,v 1.2 1996/08/19 08:33:08 tholo Exp $";
+static char rcsid[] = "$OpenBSD: tempnam.c,v 1.3 1996/08/25 10:11:08 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() && (f = getenv("TMPDIR"))) {
(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
*(f + strlen(f) - 1) == '/'? "": "/", pfx);
if (f = mktemp(name))
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c
index 83c56a8468a..ea5f177001d 100644
--- a/lib/libc/time/localtime.c
+++ b/lib/libc/time/localtime.c
@@ -1,5 +1,5 @@
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: localtime.c,v 1.4 1996/08/19 08:34:50 tholo Exp $";
+static char rcsid[] = "$OpenBSD: localtime.c,v 1.5 1996/08/25 10:11:11 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -282,7 +282,7 @@ register struct state * const sp;
if (name[0] == ':')
++name;
doaccess = name[0] == '/';
- if (!doaccess) {
+ if (!doaccess && issetugid() == 0) {
if ((p = TZDIR) == NULL)
return -1;
if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)