public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix libnsl env var handling
Date: Wed, 11 Oct 2006 09:38:00 -0000	[thread overview]
Message-ID: <20061011093741.GM4556@sunsite.mff.cuni.cz> (raw)

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  <jakub@redhat.com>

	* 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

             reply	other threads:[~2006-10-11  9:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11  9:38 Jakub Jelinek [this message]
2006-10-11 16:24 ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061011093741.GM4556@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).