summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorderaadt <>1996-08-25 10:11:02 +0000
committerderaadt <>1996-08-25 10:11:02 +0000
commit411b2edc62326f2d748e090f902cfed0a2e2c876 (patch)
tree04875b2997e695902d92b012a0a8cbfe2c5d3c38
parent2e29f3fc5238fd8757ae3420145f21ed815140b1 (diff)
downloadopenbsd-411b2edc62326f2d748e090f902cfed0a2e2c876.tar.gz
openbsd-411b2edc62326f2d748e090f902cfed0a2e2c876.tar.bz2
openbsd-411b2edc62326f2d748e090f902cfed0a2e2c876.zip
use issetugid()
-rw-r--r--src/lib/libc/net/res_init.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c
index 9992acb632..c925236869 100644
--- a/src/lib/libc/net/res_init.c
+++ b/src/lib/libc/net/res_init.c
@@ -52,7 +52,7 @@
52 */ 52 */
53 53
54#if defined(LIBC_SCCS) && !defined(lint) 54#if defined(LIBC_SCCS) && !defined(lint)
55static char rcsid[] = "$OpenBSD: res_init.c,v 1.4 1996/08/19 08:29:45 tholo Exp $"; 55static char rcsid[] = "$OpenBSD: res_init.c,v 1.5 1996/08/25 10:11:02 deraadt Exp $";
56#endif /* LIBC_SCCS and not lint */ 56#endif /* LIBC_SCCS and not lint */
57 57
58#include <sys/param.h> 58#include <sys/param.h>
@@ -114,7 +114,6 @@ res_init()
114 int nsort = 0; 114 int nsort = 0;
115 int dots; 115 int dots;
116 u_long mask; 116 u_long mask;
117 int notsuid = (getuid() == geteuid());
118 117
119 _res.nsaddr.sin_len = sizeof(struct sockaddr_in); 118 _res.nsaddr.sin_len = sizeof(struct sockaddr_in);
120 _res.nsaddr.sin_family = AF_INET; 119 _res.nsaddr.sin_family = AF_INET;
@@ -130,7 +129,7 @@ res_init()
130 strncpy(_res.lookups, "f", sizeof _res.lookups); 129 strncpy(_res.lookups, "f", sizeof _res.lookups);
131 130
132 /* Allow user to override the local domain definition */ 131 /* Allow user to override the local domain definition */
133 if (notsuid && (cp = getenv("LOCALDOMAIN")) != NULL) { 132 if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) {
134 (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); 133 (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
135 if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) 134 if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL)
136 *cp = '\0'; 135 *cp = '\0';
@@ -334,7 +333,9 @@ res_init()
334#endif 333#endif
335 } 334 }
336 335
337 if (notsuid && (cp = getenv("RES_OPTIONS")) != NULL) 336 if (issetugid())
337 _res.options |= RES_NOALIASES;
338 else if ((cp = getenv("RES_OPTIONS")) != NULL)
338 res_setoptions(cp, "env"); 339 res_setoptions(cp, "env");
339 _res.options |= RES_INIT; 340 _res.options |= RES_INIT;
340 return (0); 341 return (0);