diff options
author | 1996-08-25 10:11:02 +0000 | |
---|---|---|
committer | 1996-08-25 10:11:02 +0000 | |
commit | fdaed31805398a3d78b467d35d49e1f240f7470a (patch) | |
tree | 891e62e6e172efe31e0ab52570cab9599e07e090 /lib/libc/net/res_init.c | |
parent | Makefile.in: break mandir creation out of install-dir; (diff) | |
download | wireguard-openbsd-fdaed31805398a3d78b467d35d49e1f240f7470a.tar.xz wireguard-openbsd-fdaed31805398a3d78b467d35d49e1f240f7470a.zip |
use issetugid()
Diffstat (limited to 'lib/libc/net/res_init.c')
-rw-r--r-- | lib/libc/net/res_init.c | 9 |
1 files changed, 5 insertions, 4 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); |