diff options
Diffstat (limited to 'src/lib/libc/net/res_init.c')
-rw-r--r-- | src/lib/libc/net/res_init.c | 5 |
1 files changed, 3 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); |