From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13875 invoked by alias); 11 Oct 2006 09:38:04 -0000 Received: (qmail 13858 invoked by uid 22791); 11 Oct 2006 09:38:03 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 11 Oct 2006 09:38:00 +0000 Received: from sunsite.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.1/8.13.1) with ESMTP id k9B9bg8P001624; Wed, 11 Oct 2006 11:37:42 +0200 Received: (from jj@localhost) by sunsite.mff.cuni.cz (8.13.1/8.13.1/Submit) id k9B9bgWT001616; Wed, 11 Oct 2006 11:37:42 +0200 Date: Wed, 11 Oct 2006 09:38:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix libnsl env var handling Message-ID: <20061011093741.GM4556@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00004.txt.bz2 Hi! While NIS_DEFAULTS and NIS_GROUP env vars are never used by libnss_nisplus, NIS_PATH is (through nis_getnames/nis_list with EXPAND_NAME) and as such it is desirable to force use of the default search path for suid/sgid. Also, __nis_default_access was completely unnecessarily calling getenv on the same var twice. 2006-10-11 Jakub Jelinek * nis/nis_defaults.c (__nis_default_access): Don't call getenv twice. * nis/nis_subr.c (nis_getnames): Use __secure_getenv instead of getenv. * sysdeps/generic/unsecvars.h: Add NIS_PATH. --- libc/nis/nis_defaults.c.jj 2006-05-10 04:54:46.000000000 +0200 +++ libc/nis/nis_defaults.c 2006-10-11 09:43:52.000000000 +0200 @@ -447,7 +447,7 @@ __nis_default_access (char *param, unsig { cptr = getenv ("NIS_DEFAULTS"); if (cptr != NULL && strstr (cptr, "access=") != NULL) - result = searchaccess (getenv ("NIS_DEFAULTS"), result); + result = searchaccess (cptr, result); } return result; --- libc/nis/nis_subr.c.jj 2006-10-11 09:41:22.000000000 +0200 +++ libc/nis/nis_subr.c 2006-10-11 10:58:37.000000000 +0200 @@ -178,7 +178,7 @@ nis_getnames (const_nis_name name) } /* Get the search path, where we have to search "name" */ - path = getenv ("NIS_PATH"); + path = __secure_getenv ("NIS_PATH"); if (path == NULL) path = strdupa ("$"); else --- libc/sysdeps/generic/unsecvars.h.jj 2005-01-06 23:40:19.000000000 +0100 +++ libc/sysdeps/generic/unsecvars.h 2006-10-11 11:06:43.000000000 +0200 @@ -18,6 +18,7 @@ "LOCALDOMAIN\0" \ "LOCPATH\0" \ "MALLOC_TRACE\0" \ + "NIS_PATH\0" \ "NLSPATH\0" \ "RESOLV_HOST_CONF\0" \ "RES_OPTIONS\0" \ Jakub