eglibc-2.15-nsswitchconf-location.3.diff 1.25 KB
Newer Older
1 2 3 4 5 6
diff -ru eglibc-2.15/nss/nsswitch.c eglibc-2.15-nsswitch/nss/nsswitch.c
--- eglibc-2.15/nss/nsswitch.c	2011-11-17 22:56:08.000000000 +0100
+++ eglibc-2.15-nsswitch/nss/nsswitch.c	2012-02-22 10:38:02.004928523 +0100
@@ -53,6 +53,8 @@
    See ../option-groups.def for the details.  */
 #if __OPTION_EGLIBC_NSSWITCH
7 8 9 10 11 12
 
+#include <unistd.h> /* __libc_enable_secure */
+
 /* Prototypes for the local functions.  */
 static name_database *nss_parse_file (const char *fname) internal_function;
 static name_database_entry *nss_getline (char *line) internal_function;
13 14
@@ -141,8 +143,16 @@
 #if __OPTION_EGLIBC_NSSWITCH
15 16 17 18 19 20 21 22 23 24 25 26 27 28
   /* Are we initialized yet?  */
   if (service_table == NULL)
-    /* Read config file.  */
-    service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
+    {
+      const char *ext_nss_config_file = NULL;
+      if (__libc_enable_secure == 0)
+	{
+	  ext_nss_config_file = getenv ("NSSWITCH_CONF_PATH");
+	}
+      /* Read config file.  */
+      service_table = nss_parse_file (ext_nss_config_file ?
+		ext_nss_config_file : _PATH_NSSWITCH_CONF);
+    }
29
 #endif
30 31
 
   /* Test whether configuration data is available.  */
32 33 34
Only in eglibc-2.15-nsswitch/nss: nsswitch.c~
Only in eglibc-2.15-nsswitch/nss: nsswitch.c.orig
Only in eglibc-2.15-nsswitch/nss: nsswitch.c.rej