about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-12-29 20:56:13 +0000
committerUlrich Drepper <drepper@redhat.com>2008-12-29 20:56:13 +0000
commit50e481ceebce7936e773ced188d830659bdf9e40 (patch)
tree8c929020a8aa0abd1c1b0d8abbbe0c0a2f494ba8 /nscd
parent217d45cd35c2558997942eacfe49684e460c9ee4 (diff)
downloadglibc-50e481ceebce7936e773ced188d830659bdf9e40.tar.gz
glibc-50e481ceebce7936e773ced188d830659bdf9e40.tar.xz
glibc-50e481ceebce7936e773ced188d830659bdf9e40.zip
* nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd if
	LOCALDOMAIN is defined.
	* nscd/nscd_getai.c (__nscd_getai): Likewise.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd_getai.c16
-rw-r--r--nscd/nscd_gethst_r.c15
2 files changed, 29 insertions, 2 deletions
diff --git a/nscd/nscd_getai.c b/nscd/nscd_getai.c
index 56f963776e..674a5e7514 100644
--- a/nscd/nscd_getai.c
+++ b/nscd/nscd_getai.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -36,10 +36,24 @@ extern int __nss_not_use_nscd_hosts;
 /* We use the mapping from nscd_gethst.  */
 libc_locked_map_ptr (extern, __hst_map_handle) attribute_hidden;
 
+/* Defined in nscd_gethst_r.c.  */
+extern int __nss_have_localdomain attribute_hidden;
+
 
 int
 __nscd_getai (const char *key, struct nscd_ai_result **result, int *h_errnop)
 {
+  if (__builtin_expect (__nss_have_localdomain >= 0, 0))
+    {
+      if (__nss_have_localdomain == 0)
+	__nss_have_localdomain = getenv ("LOCALDOMAIN") != NULL ? 1 : -1;
+      if (__nss_have_localdomain > 0)
+	{
+	  __nss_not_use_nscd_hosts = 1;
+	  return -1;
+	}
+    }
+
   size_t keylen = strlen (key) + 1;
   int gc_cycle;
   int nretries = 0;
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index a211404756..aea8288594 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2005, 2006, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -97,12 +97,25 @@ libc_freeres_fn (hst_map_free)
 }
 
 
+int __nss_have_localdomain attribute_hidden;
+
 static int
 internal_function
 nscd_gethst_r (const char *key, size_t keylen, request_type type,
 	       struct hostent *resultbuf, char *buffer, size_t buflen,
 	       struct hostent **result, int *h_errnop)
 {
+  if (__builtin_expect (__nss_have_localdomain >= 0, 0))
+    {
+      if (__nss_have_localdomain == 0)
+	__nss_have_localdomain = getenv ("LOCALDOMAIN") != NULL ? 1 : -1;
+      if (__nss_have_localdomain > 0)
+	{
+	  __nss_not_use_nscd_hosts = 1;
+	  return -1;
+	}
+    }
+
   int gc_cycle;
   int nretries = 0;