glibc-2.25-nsswitchconf-location.diff 1.09 KB
Newer Older
1 2 3
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
4 5 6 7
@@ -41,6 +41,8 @@
 #include "../nscd/nscd_proto.h"
 #include <sysdep.h>

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
@@ -121,8 +123,16 @@ __nss_database_lookup (const char *datab

15 16
   /* Are we initialized yet?  */
   if (service_table == NULL)
17 18 19
+  {
+    const char *ext_nss_config_file = NULL;
+    if (__libc_enable_secure == 0)
20
+    {
21
+        ext_nss_config_file = getenv ("NSSWITCH_CONF_PATH");
22
+    }
23 24 25 26 27 28
     /* Read config file.  */
-    service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
+    service_table = nss_parse_file (ext_nss_config_file ?
+        ext_nss_config_file : _PATH_NSSWITCH_CONF);
+  }

29
   /* Test whether configuration data is available.  */
30
   if (service_table != NULL)