hesiod.c (66451) | hesiod.c (66485) |
---|---|
1/* $NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $ */ 2 3/* Copyright (c) 1996 by Internet Software Consortium. 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * --- 33 unchanged lines hidden (view full) --- 42 * This implementation is not truly thread-safe at the moment because 43 * it uses res_send() and accesses _res. 44 */ 45 46#include <sys/cdefs.h> 47 48#if defined(LIBC_SCCS) && !defined(lint) 49static char *orig_rcsid = "$NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $"; | 1/* $NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $ */ 2 3/* Copyright (c) 1996 by Internet Software Consortium. 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * --- 33 unchanged lines hidden (view full) --- 42 * This implementation is not truly thread-safe at the moment because 43 * it uses res_send() and accesses _res. 44 */ 45 46#include <sys/cdefs.h> 47 48#if defined(LIBC_SCCS) && !defined(lint) 49static char *orig_rcsid = "$NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $"; |
50static char *rcsid = "$FreeBSD: head/lib/libc/net/hesiod.c 66451 2000-09-29 12:56:33Z nectar $"; | 50static char *rcsid = "$FreeBSD: head/lib/libc/net/hesiod.c 66485 2000-09-30 17:29:54Z nectar $"; |
51#endif /* LIBC_SCCS and not lint */ 52 53#include <sys/types.h> 54#include <sys/param.h> 55#include <netinet/in.h> 56#include <arpa/nameser.h> 57 58#include <ctype.h> --- 24 unchanged lines hidden (view full) --- 83 * initialize a hesiod_p. 84 */ 85int 86hesiod_init(context) 87 void **context; 88{ 89 struct hesiod_p *ctx; 90 const char *p, *configname; | 51#endif /* LIBC_SCCS and not lint */ 52 53#include <sys/types.h> 54#include <sys/param.h> 55#include <netinet/in.h> 56#include <arpa/nameser.h> 57 58#include <ctype.h> --- 24 unchanged lines hidden (view full) --- 83 * initialize a hesiod_p. 84 */ 85int 86hesiod_init(context) 87 void **context; 88{ 89 struct hesiod_p *ctx; 90 const char *p, *configname; |
91 int trust; | |
92 | 91 |
93 trust = geteuid() == getuid() && getegid() == getgid(); 94 | |
95 ctx = malloc(sizeof(struct hesiod_p)); 96 if (ctx) { 97 *context = ctx; | 92 ctx = malloc(sizeof(struct hesiod_p)); 93 if (ctx) { 94 *context = ctx; |
98 if (trust) | 95 if (!issetugid()) |
99 configname = getenv("HESIOD_CONFIG"); 100 else 101 configname = NULL; 102 if (!configname) 103 configname = _PATH_HESIOD_CONF; 104 if (read_config_file(ctx, configname) >= 0) { 105 /* 106 * The default rhs can be overridden by an 107 * environment variable. 108 */ | 96 configname = getenv("HESIOD_CONFIG"); 97 else 98 configname = NULL; 99 if (!configname) 100 configname = _PATH_HESIOD_CONF; 101 if (read_config_file(ctx, configname) >= 0) { 102 /* 103 * The default rhs can be overridden by an 104 * environment variable. 105 */ |
109 if (trust) | 106 if (!issetugid()) |
110 p = getenv("HES_DOMAIN"); 111 else 112 p = NULL; 113 if (p) { 114 if (ctx->rhs) 115 free(ctx->rhs); 116 ctx->rhs = malloc(strlen(p) + 2); 117 if (ctx->rhs) { --- 465 unchanged lines hidden --- | 107 p = getenv("HES_DOMAIN"); 108 else 109 p = NULL; 110 if (p) { 111 if (ctx->rhs) 112 free(ctx->rhs); 113 ctx->rhs = malloc(strlen(p) + 2); 114 if (ctx->rhs) { --- 465 unchanged lines hidden --- |