about summary refs log tree commit diff
path: root/nss/getXXbyYY_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/getXXbyYY_r.c')
-rw-r--r--nss/getXXbyYY_r.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
index 47df01054e..d20fa34498 100644
--- a/nss/getXXbyYY_r.c
+++ b/nss/getXXbyYY_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include "nsswitch.h"
+#include <nscd/nscd_proto.h>
 
 /*******************************************************************\
 |* Here we assume several symbols to be defined:		   *|
@@ -51,6 +52,12 @@
 #define INTERNAL(name) INTERNAL1 (name)
 #define INTERNAL1(name) __##name
 
+#ifdef USE_NSCD
+# define NSCD_NAME ADD_NSCD (REENTRANT_NAME)
+# define ADD_NSCD(name) ADD_NSCD1 (name)
+# define ADD_NSCD1(name) __nscd_##name
+#endif
+
 #define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME)
 #define REENTRANT_NAME_STRING STRINGIZE (REENTRANT_NAME)
 #define DATABASE_NAME_STRING STRINGIZE (DATABASE_NAME)
@@ -93,6 +100,9 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
   lookup_function fct;
   int no_more;
   enum nss_status status = NSS_STATUS_UNAVAIL;
+#ifdef USE_NSCD
+  int nscd_status;
+#endif
 
 #ifdef HANDLE_DIGITS_DOTS
 # define resbuf (*resbuf)
@@ -100,6 +110,15 @@ INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
 # undef resbuf
 #endif
 
+#ifdef USE_NSCD
+  nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen H_ERRNO_VAR);
+  if (nscd_status < 1)
+    {
+      *result = nscd_status == 0 ? resbuf : NULL;
+      return nscd_status;
+    }
+#endif
+
   if (startp == NULL)
     {
       no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING, (void **) &fct);