This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix libnsl env var handling


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]