File: glibc-2.10-nsswitchconf-location.3.patch

package info (click to toggle)
scratchbox2 2.2.4-1debian1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 5,392 kB
  • ctags: 5,239
  • sloc: ansic: 21,734; sh: 4,360; perl: 2,170; cpp: 1,913; makefile: 610; python: 184
file content (32 lines) | stat: -rw-r--r-- 1,145 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Index: eglibc-2.10/nss/nsswitch.c
===================================================================
--- eglibc-2.10.orig/nss/nsswitch.c	2009-10-12 21:29:23.000000000 +0300
+++ eglibc-2.10/nss/nsswitch.c	2010-04-16 12:56:31.000000000 +0300
@@ -42,6 +42,8 @@
 #include "nsswitch.h"
 #include "../nscd/nscd_proto.h"
 
+#include <unistd.h> /* __libc_enable_secure */
+
 /* When OPTION_EGLIBC_NSSWITCH is disabled, we use fixed tables of
    databases and services, generated at library build time.  Thus:
    - We can't reconfigure individual databases, so we don't need a
@@ -130,8 +132,16 @@
 #if __OPTION_EGLIBC_NSSWITCH
   /* 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);
+    }
 #endif
 
   /* Test whether configuration data is available.  */