about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-08-22 13:31:12 -0700
committerRoland McGrath <roland@hack.frob.com>2012-08-22 13:31:12 -0700
commit3cc3ef96d6c060e9d45b43f5482dc4e03945b30e (patch)
tree38fbe47c74c5109f408d107696950923d1b68ff6 /inet
parent07e515506660b1d0c1934dc0ac0e2ac5e7a4a760 (diff)
downloadglibc-3cc3ef96d6c060e9d45b43f5482dc4e03945b30e.tar.gz
glibc-3cc3ef96d6c060e9d45b43f5482dc4e03945b30e.tar.xz
glibc-3cc3ef96d6c060e9d45b43f5482dc4e03945b30e.zip
BZ#13696: Add --disable-nscd configure option.
Diffstat (limited to 'inet')
-rw-r--r--inet/Makefile8
-rw-r--r--inet/getnetgrent_r.c41
2 files changed, 29 insertions, 20 deletions
diff --git a/inet/Makefile b/inet/Makefile
index 80e2d7ab2e..1af5dc70d1 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -56,11 +56,11 @@ include ../Rules
 
 ifeq ($(have-thread-library),yes)
 
-CFLAGS-gethstbyad_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbyad_r.c = -fexceptions
 CFLAGS-gethstbyad.c = -fexceptions
-CFLAGS-gethstbynm_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm_r.c = -fexceptions
 CFLAGS-gethstbynm.c = -fexceptions
-CFLAGS-gethstbynm2_r.c = -DUSE_NSCD=1 -fexceptions
+CFLAGS-gethstbynm2_r.c = -fexceptions
 CFLAGS-gethstbynm2.c = -fexceptions
 CFLAGS-gethstent_r.c = -fexceptions
 CFLAGS-gethstent.c = -fexceptions
@@ -77,8 +77,6 @@ CFLAGS-getrpcent_r.c = -fexceptions
 CFLAGS-getrpcent.c = -fexceptions
 CFLAGS-getservent_r.c = -fexceptions
 CFLAGS-getservent.c = -fexceptions
-CFLAGS-getsrvbynm_r.c = -DUSE_NSCD=1
-CFLAGS-getsrvbypt_r.c = -DUSE_NSCD=1
 CFLAGS-getprtent_r.c = -fexceptions
 CFLAGS-getprtent.c = -fexceptions
 CFLAGS-either_ntoh.c = -fexceptions
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index c57e7de178..8e69ec7b11 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -182,28 +182,32 @@ __internal_setnetgrent (const char *group, struct __netgrent *datap)
 }
 libc_hidden_def (__internal_setnetgrent)
 
-int
-setnetgrent (const char *group)
+static int
+nscd_setnetgrent (const char *group)
 {
-  int result;
-
-  __libc_lock_lock (lock);
-
+#ifdef USE_NSCD
   if (__nss_not_use_nscd_netgroup > 0
       && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
     __nss_not_use_nscd_netgroup = 0;
 
   if (!__nss_not_use_nscd_netgroup
       && !__nss_database_custom[NSS_DBSIDX_netgroup])
-    {
-      result = __nscd_setnetgrent (group, &dataset);
-      if (result >= 0)
-	goto out;
-    }
+    return __nscd_setnetgrent (group, &dataset);
+#endif
+  return -1;
+}
 
-  result = __internal_setnetgrent (group, &dataset);
+int
+setnetgrent (const char *group)
+{
+  int result;
+
+  __libc_lock_lock (lock);
+
+  result = nscd_setnetgrent (group);
+  if (result < 0)
+    result = __internal_setnetgrent (group, &dataset);
 
- out:
   __libc_lock_unlock (lock);
 
   return result;
@@ -230,7 +234,7 @@ endnetgrent (void)
   __libc_lock_unlock (lock);
 }
 
-
+#ifdef USE_NSCD
 static enum nss_status
 nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
 		  int *errnop)
@@ -248,7 +252,7 @@ nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
 
   return NSS_STATUS_SUCCESS;
 }
-
+#endif
 
 int
 internal_function
@@ -267,9 +271,14 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
   int no_more = datap->nip == NULL;
   if (! no_more)
     {
+#ifdef USE_NSCD
+      /* This bogus function pointer is a special marker left by
+         __nscd_setnetgrent to tell us to use the data it left
+         before considering any modules.  */
       if (datap->nip == (service_user *) -1l)
 	fct = nscd_getnetgrent;
       else
+#endif
 	{
 	  fct = __nss_lookup_function (datap->nip, "getnetgrent_r");
 	  no_more = fct == NULL;
@@ -375,6 +384,7 @@ int
 innetgr (const char *netgroup, const char *host, const char *user,
 	 const char *domain)
 {
+#ifdef USE_NSCD
   if (__nss_not_use_nscd_netgroup > 0
       && ++__nss_not_use_nscd_netgroup > NSS_NSCD_RETRY)
     __nss_not_use_nscd_netgroup = 0;
@@ -386,6 +396,7 @@ innetgr (const char *netgroup, const char *host, const char *user,
       if (result >= 0)
 	return result;
     }
+#endif
 
   union
   {