diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libc/net/res_init.c | 5 | ||||
| -rw-r--r-- | src/lib/libc/net/res_query.c | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c index ff8e1b1e5e..2a1f454250 100644 --- a/src/lib/libc/net/res_init.c +++ b/src/lib/libc/net/res_init.c | |||
| @@ -121,6 +121,7 @@ res_init() | |||
| 121 | int nsort = 0; | 121 | int nsort = 0; |
| 122 | int dots; | 122 | int dots; |
| 123 | u_long mask; | 123 | u_long mask; |
| 124 | int notsuid = (getuid() == geteuid()); | ||
| 124 | 125 | ||
| 125 | _res.nsaddr.sin_len = sizeof(struct sockaddr_in); | 126 | _res.nsaddr.sin_len = sizeof(struct sockaddr_in); |
| 126 | _res.nsaddr.sin_family = AF_INET; | 127 | _res.nsaddr.sin_family = AF_INET; |
| @@ -136,7 +137,7 @@ res_init() | |||
| 136 | strncpy(_res.lookups, "f", sizeof _res.lookups); | 137 | strncpy(_res.lookups, "f", sizeof _res.lookups); |
| 137 | 138 | ||
| 138 | /* Allow user to override the local domain definition */ | 139 | /* Allow user to override the local domain definition */ |
| 139 | if ((cp = getenv("LOCALDOMAIN")) != NULL) { | 140 | if (notsuid && (cp = getenv("LOCALDOMAIN")) != NULL) { |
| 140 | (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); | 141 | (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); |
| 141 | if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) | 142 | if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) |
| 142 | *cp = '\0'; | 143 | *cp = '\0'; |
| @@ -340,7 +341,7 @@ res_init() | |||
| 340 | #endif | 341 | #endif |
| 341 | } | 342 | } |
| 342 | 343 | ||
| 343 | if ((cp = getenv("RES_OPTIONS")) != NULL) | 344 | if (notsuid && (cp = getenv("RES_OPTIONS")) != NULL) |
| 344 | res_setoptions(cp, "env"); | 345 | res_setoptions(cp, "env"); |
| 345 | _res.options |= RES_INIT; | 346 | _res.options |= RES_INIT; |
| 346 | return (0); | 347 | return (0); |
diff --git a/src/lib/libc/net/res_query.c b/src/lib/libc/net/res_query.c index 81c4d3194d..61b6cb35c9 100644 --- a/src/lib/libc/net/res_query.c +++ b/src/lib/libc/net/res_query.c | |||
| @@ -368,6 +368,8 @@ __hostalias(name) | |||
| 368 | 368 | ||
| 369 | if (_res.options & RES_NOALIASES) | 369 | if (_res.options & RES_NOALIASES) |
| 370 | return (NULL); | 370 | return (NULL); |
| 371 | if (getuid() != setuid()) | ||
| 372 | return (NULL); | ||
| 371 | file = getenv("HOSTALIASES"); | 373 | file = getenv("HOSTALIASES"); |
| 372 | if (file == NULL || (fp = fopen(file, "r")) == NULL) | 374 | if (file == NULL || (fp = fopen(file, "r")) == NULL) |
| 373 | return (NULL); | 375 | return (NULL); |
