Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/lib/libc/net Pull up revision 1.15 (requested by sommer...



details:   https://anonhg.NetBSD.org/src/rev/43b4111ed33f
branches:  netbsd-1-4
changeset: 471201:43b4111ed33f
user:      he <he%NetBSD.org@localhost>
date:      Tue Oct 31 14:59:45 2000 +0000

description:
Pull up revision 1.15 (requested by sommerfeld):
  If setuid, ignore environment variables.

diffstat:

 lib/libc/net/hesiod.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (55 lines):

diff -r ddd4da2756b0 -r 43b4111ed33f lib/libc/net/hesiod.c
--- a/lib/libc/net/hesiod.c     Tue Oct 31 14:01:33 2000 +0000
+++ b/lib/libc/net/hesiod.c     Tue Oct 31 14:59:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $        */
+/*     $NetBSD: hesiod.c,v 1.9.2.1 2000/10/31 14:59:45 he Exp $        */
 
 /* Copyright (c) 1996 by Internet Software Consortium.
  *
@@ -52,7 +52,7 @@
     "#Id: hesiod_p.h,v 1.1 1996/12/08 21:39:37 ghudson Exp #");
 __IDSTRING(rcsid_hescompat_c,
     "#Id: hescompat.c,v 1.1.2.1 1996/12/16 08:37:45 ghudson Exp #");
-__RCSID("$NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $");
+__RCSID("$NetBSD: hesiod.c,v 1.9.2.1 2000/10/31 14:59:45 he Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -69,6 +69,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #ifdef __weak_alias
 __weak_alias(hesiod_init,_hesiod_init);
@@ -111,15 +112,25 @@
        ctx = malloc(sizeof(struct hesiod_p));
        if (ctx) {
                *context = ctx;
-               configname = getenv("HESIOD_CONFIG");
+                       /*
+                        * don't permit overrides from environment
+                        * for set.id programs
+                        */
+               if (issetugid())
+                       configname = NULL;
+               else
+                       configname = getenv("HESIOD_CONFIG");
                if (!configname)
                        configname = _PATH_HESIOD_CONF;
                if (read_config_file(ctx, configname) >= 0) {
                        /*
                         * The default rhs can be overridden by an
-                        * environment variable.
+                        * environment variable, unless set.id.
                         */
-                       p = getenv("HES_DOMAIN");
+                       if (issetugid())
+                               p = NULL;
+                       else
+                               p = getenv("HES_DOMAIN");
                        if (p) {
                                if (ctx->rhs)
                                        free(ctx->rhs);



Home | Main Index | Thread Index | Old Index