summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/hesiod.c
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2000-09-29 12:56:33 +0000
committernectar <nectar@FreeBSD.org>2000-09-29 12:56:33 +0000
commitb6189aae3275e10c2872ce44741ccac24324fbc8 (patch)
tree547e5ddf61d5f6b7717f30c5eca89d42958b4067 /lib/libc/net/hesiod.c
parent3985f458893cb9beccd77acd4bc6cfb155f7d5ca (diff)
downloadFreeBSD-src-b6189aae3275e10c2872ce44741ccac24324fbc8.zip
FreeBSD-src-b6189aae3275e10c2872ce44741ccac24324fbc8.tar.gz
Ignore HESIOD_CONFIG and HES_DOMAIN environmental variables for
set-user-ID and set-group-ID programs. Suggested by: Danny Braniss <danny@cs.huji.ac.il>
Diffstat (limited to 'lib/libc/net/hesiod.c')
-rw-r--r--lib/libc/net/hesiod.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/libc/net/hesiod.c b/lib/libc/net/hesiod.c
index f36757b..220244c 100644
--- a/lib/libc/net/hesiod.c
+++ b/lib/libc/net/hesiod.c
@@ -62,6 +62,7 @@ static char *rcsid = "$FreeBSD$";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
struct hesiod_p {
char *lhs; /* normally ".ns" */
@@ -87,11 +88,17 @@ hesiod_init(context)
{
struct hesiod_p *ctx;
const char *p, *configname;
+ int trust;
+
+ trust = geteuid() == getuid() && getegid() == getgid();
ctx = malloc(sizeof(struct hesiod_p));
if (ctx) {
*context = ctx;
- configname = getenv("HESIOD_CONFIG");
+ if (trust)
+ configname = getenv("HESIOD_CONFIG");
+ else
+ configname = NULL;
if (!configname)
configname = _PATH_HESIOD_CONF;
if (read_config_file(ctx, configname) >= 0) {
@@ -99,7 +106,10 @@ hesiod_init(context)
* The default rhs can be overridden by an
* environment variable.
*/
- p = getenv("HES_DOMAIN");
+ if (trust)
+ p = getenv("HES_DOMAIN");
+ else
+ p = NULL;
if (p) {
if (ctx->rhs)
free(ctx->rhs);
OpenPOWER on IntegriCloud