Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net don't look at $HOSTALIASES, if issetugid() says...



details:   https://anonhg.NetBSD.org/src/rev/fff8da00c985
branches:  trunk
changeset: 485420:fff8da00c985
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Apr 27 16:32:37 2000 +0000

description:
don't look at $HOSTALIASES, if issetugid() says the binary is dirty.

diffstat:

 lib/libc/net/res_query.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 264b18cc6334 -r fff8da00c985 lib/libc/net/res_query.c
--- a/lib/libc/net/res_query.c  Thu Apr 27 16:27:35 2000 +0000
+++ b/lib/libc/net/res_query.c  Thu Apr 27 16:32:37 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: res_query.c,v 1.27 2000/04/26 06:51:37 itojun Exp $    */
+/*     $NetBSD: res_query.c,v 1.28 2000/04/27 16:32:37 itojun Exp $    */
 
 /*-
  * Copyright (c) 1988, 1993
@@ -59,7 +59,7 @@
 static char sccsid[] = "@(#)res_query.c        8.1 (Berkeley) 6/4/93";
 static char rcsid[] = "Id: res_query.c,v 8.10 1997/06/01 20:34:37 vixie Exp ";
 #else
-__RCSID("$NetBSD: res_query.c,v 1.27 2000/04/26 06:51:37 itojun Exp $");
+__RCSID("$NetBSD: res_query.c,v 1.28 2000/04/27 16:32:37 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -79,6 +79,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #if defined(_LIBC) && defined(__weak_alias)
 __weak_alias(res_query,_res_query)
@@ -394,9 +395,11 @@
        if (_res.options & RES_NOALIASES)
                return (NULL);
        /*
-        * XXX potential security problem if this file is not normally 
-        * readable by the user of a setuid program.
+        * forbid hostaliases for setuid binray, due to possible security
+        * breach.
         */
+       if (issetugid())
+               return (NULL);
        file = getenv("HOSTALIASES");
        if (file == NULL || (fp = fopen(file, "r")) == NULL)
                return (NULL);



Home | Main Index | Thread Index | Old Index