diff options
| author | Jacques Vidrine <nectar@FreeBSD.org> | 2000-09-29 12:56:33 +0000 | 
|---|---|---|
| committer | Jacques Vidrine <nectar@FreeBSD.org> | 2000-09-29 12:56:33 +0000 | 
| commit | b27eae53e9115c750dab2cb31dd60c166fccc7ac (patch) | |
| tree | 4bbc76828fc3974e26d336d7c6c805e065e5f726 /lib/libc/net/hesiod.c | |
| parent | ce6da1a92a81fb8a771f5cd547aa198ffb8882f3 (diff) | |
Notes
Diffstat (limited to 'lib/libc/net/hesiod.c')
| -rw-r--r-- | lib/libc/net/hesiod.c | 14 | 
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/libc/net/hesiod.c b/lib/libc/net/hesiod.c index f36757be05cb..220244c5d947 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);  | 
