summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/net/res_init.c5
-rw-r--r--lib/libc/net/res_query.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c
index ff8e1b1e5e6..2a1f4542507 100644
--- a/lib/libc/net/res_init.c
+++ b/lib/libc/net/res_init.c
@@ -121,6 +121,7 @@ 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;
@@ -136,7 +137,7 @@ res_init()
strncpy(_res.lookups, "f", sizeof _res.lookups);
/* Allow user to override the local domain definition */
- if ((cp = getenv("LOCALDOMAIN")) != NULL) {
+ if (notsuid && (cp = getenv("LOCALDOMAIN")) != NULL) {
(void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL)
*cp = '\0';
@@ -340,7 +341,7 @@ res_init()
#endif
}
- if ((cp = getenv("RES_OPTIONS")) != NULL)
+ if (notsuid && (cp = getenv("RES_OPTIONS")) != NULL)
res_setoptions(cp, "env");
_res.options |= RES_INIT;
return (0);
diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c
index 81c4d3194d3..61b6cb35c9b 100644
--- a/lib/libc/net/res_query.c
+++ b/lib/libc/net/res_query.c
@@ -368,6 +368,8 @@ __hostalias(name)
if (_res.options & RES_NOALIASES)
return (NULL);
+ if (getuid() != setuid())
+ return (NULL);
file = getenv("HOSTALIASES");
if (file == NULL || (fp = fopen(file, "r")) == NULL)
return (NULL);