[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r4014 - in /fsf/trunk/libc: ./ include/ inet/ nscd/ nss/ resolv/ resolv/nss_dns/ sunrpc/



Author: eglibc
Date: Tue Oct 30 00:02:49 2007
New Revision: 4014

Log:
Import glibc-mainline for 2007-10-30

Added:
    fsf/trunk/libc/nscd/gethstbynm3_r.c
Removed:
    fsf/trunk/libc/nscd/gethstbynm2_r.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/include/netdb.h
    fsf/trunk/libc/inet/ether_hton.c
    fsf/trunk/libc/inet/ether_ntoh.c
    fsf/trunk/libc/inet/gethstbyad_r.c
    fsf/trunk/libc/inet/gethstbynm2_r.c
    fsf/trunk/libc/inet/gethstbynm_r.c
    fsf/trunk/libc/inet/gethstent_r.c
    fsf/trunk/libc/inet/getnetgrent_r.c
    fsf/trunk/libc/nscd/Makefile
    fsf/trunk/libc/nscd/aicache.c
    fsf/trunk/libc/nscd/gethstbyad_r.c
    fsf/trunk/libc/nscd/hstcache.c
    fsf/trunk/libc/nss/Versions
    fsf/trunk/libc/nss/XXX-lookup.c
    fsf/trunk/libc/nss/getXXbyYY_r.c
    fsf/trunk/libc/nss/getXXent_r.c
    fsf/trunk/libc/nss/getnssent_r.c
    fsf/trunk/libc/nss/nsswitch.c
    fsf/trunk/libc/nss/nsswitch.h
    fsf/trunk/libc/nss/service-lookup.c
    fsf/trunk/libc/resolv/Versions
    fsf/trunk/libc/resolv/nss_dns/dns-host.c
    fsf/trunk/libc/sunrpc/netname.c
    fsf/trunk/libc/sunrpc/publickey.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Oct 30 00:02:49 2007
@@ -1,3 +1,58 @@
+2007-10-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/Versions [libresolv] (GLIBC_PRIVATE): Add
+	_nss_dns_getnetbyaddr2_r.
+	* resolv/nss_dns/dns-host.c: Define _nss_dns_getnetbyaddr2_r.  Pass
+	extra parameter to getanswer_r.
+	(_nss_dns_getnetbyaddr_r): Now a wrapper around
+	_nss_dns_getnetbyaddr2_r.
+
+	* nscd/Makefile (nscd-modules): Replace gethstbynm2_r with
+	gethstbynm3_r.
+	* nscd/gethstbynm2_r.c: Remove.
+	* nscd/gethstbynm3_r.c: New file.
+	* nscd/aicache.c (addhstaiX): Use __gethostbyaddr2_r instead of
+	__gethostbyaddr_r.
+	* nscd/gethstbyad_r.c: Generate __gethostbyaddr2_r function.  Define
+	__gethostbyaddr_r compatibility wrapper.
+	* nscd/hstcache.c (cache_addhst): Add ttl parameter.  Use it when
+	determining timeout of entry.
+	(lookup): Take new parameter and pass it to __gethostbyname3_r and
+	__gethostbyaddr2_r.
+	(addhstbyX): Pass reference to variable for TTL to lookup and
+	cache_addhst.
+	* nss/Versions [glibc] (GLIBC_PRIVATE): Export __nss_passwd_lookup2,
+	__nss_group_lookup2, __nss_hosts_lookup2, __nss_services_lookup2,
+	and __nss_next2.  Remove __nss_services_lookup.
+	* nss/XXX-lookup.c: Name function now *_lookup2.  Add new parameter.
+	Add compat wrapper.
+	* nss/getXXbyYY_r.c: Changes to call new *_lookup2 functions and
+	__nss_next2.
+	* nss/getXXent_r.c: Likewise.
+	* nss/getnssent_r.c: Likewise.
+	* nss/nsswitch.c (__nss_lookup): Add new parameter.  If first function
+	does not exist in module, try the optional second name.
+	(__nss_next2): New function.
+	(__nss_next): Now wrapper around __nss_next2.
+	* nss/nsswitch.h: Adjust __nss_lookup prototype.
+	Declare __nss_next2.
+	Adjust definition of db_lookup_function type.
+	* nss/service-lookup.c: Define NO_COMPAT.
+	* include/netdb.h: Declare __gethostbyaddr2_r and __gethostbyname3_r.
+	* inet/ether_hton.c: Use __nss_next2 instead of __nss_next.
+	* inet/ether_ntoh.c: Likewise.
+	* sunrpc/netname.c: Likewise.
+	* sunrpc/publickey.c: Likewise.
+	* inet/getnetgrent.c: Likewise.  Adjust calls to __nss_lookup.
+	* inet/gethstbyad_r.c (DB_LOOKUP_FCT): Change to __nss_hosts_lookup2.
+	* inet/gethstbynm2_r.c (DB_LOOKUP_FCT): Likewise.
+	* inet/gethstbynm_r.c (DB_LOOKUP_FCT): Likewise.
+	* inet/gethstent_r.c (DB_LOOKUP_FCT): Likewise.
+
+	* nscd/aicache.c (addhstaiX): Fix default TTL handling.
+
+	* inet/getnetgrent.c (setup): Encrypt static pointer.
+
 2007-10-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #5204]

Modified: fsf/trunk/libc/include/netdb.h
==============================================================================
--- fsf/trunk/libc/include/netdb.h (original)
+++ fsf/trunk/libc/include/netdb.h Tue Oct 30 00:02:49 2007
@@ -62,6 +62,14 @@
 				  struct hostent **__restrict __result,
 				  int *__restrict __h_errnop);
 
+extern int __gethostbyaddr2_r (__const void *__restrict __addr,
+			       socklen_t __len, int __type,
+			       struct hostent *__restrict __result_buf,
+			       char *__restrict __buf, size_t __buflen,
+			       struct hostent **__restrict __result,
+			       int *__restrict __h_errnop,
+			       int32_t *ttlp);
+
 extern int __gethostbyname_r (__const char *__restrict __name,
 			      struct hostent *__restrict __result_buf,
 			      char *__restrict __buf, size_t __buflen,
@@ -83,6 +91,13 @@
 				   char *__restrict __buf, size_t __buflen,
 				   struct hostent **__restrict __result,
 				   int *__restrict __h_errnop);
+
+extern int __gethostbyname3_r (__const char *__restrict __name, int __af,
+			       struct hostent *__restrict __result_buf,
+			       char *__restrict __buf, size_t __buflen,
+			       struct hostent **__restrict __result,
+			       int *__restrict __h_errnop,
+			       int32_t *ttlp, char **canonp);
 
 extern int __getnetent_r (struct netent *__restrict __result_buf,
 			  char *__restrict __buf, size_t __buflen,

Modified: fsf/trunk/libc/inet/ether_hton.c
==============================================================================
--- fsf/trunk/libc/inet/ether_hton.c (original)
+++ fsf/trunk/libc/inet/ether_hton.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1999, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -71,7 +71,7 @@
 
       status = (*fct.f) (hostname, &etherent, buffer, sizeof buffer, &errno);
 
-      no_more = __nss_next (&nip, "gethostton_r", &fct.ptr, status, 0);
+      no_more = __nss_next2 (&nip, "gethostton_r", NULL, &fct.ptr, status, 0);
     }
 
   if (status == NSS_STATUS_SUCCESS)

Modified: fsf/trunk/libc/inet/ether_ntoh.c
==============================================================================
--- fsf/trunk/libc/inet/ether_ntoh.c (original)
+++ fsf/trunk/libc/inet/ether_ntoh.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1999,2001,2002,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -72,7 +72,7 @@
 
       status = (*fct.f) (addr, &etherent, buffer, sizeof buffer, &errno);
 
-      no_more = __nss_next (&nip, "getntohost_r", &fct.ptr, status, 0);
+      no_more = __nss_next2 (&nip, "getntohost_r", NULL, &fct.ptr, status, 0);
     }
 
   if (status == NSS_STATUS_SUCCESS)

Modified: fsf/trunk/libc/inet/gethstbyad_r.c
==============================================================================
--- fsf/trunk/libc/inet/gethstbyad_r.c (original)
+++ fsf/trunk/libc/inet/gethstbyad_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,2002,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -48,6 +48,6 @@
     }
 
 /* Special name for the lookup function.  */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
 
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/gethstbynm2_r.c
==============================================================================
--- fsf/trunk/libc/inet/gethstbynm2_r.c (original)
+++ fsf/trunk/libc/inet/gethstbynm2_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -41,6 +41,6 @@
 #define HAVE_AF			1
 
 /* Special name for the lookup function.  */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
 
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/gethstbynm_r.c
==============================================================================
--- fsf/trunk/libc/inet/gethstbynm_r.c (original)
+++ fsf/trunk/libc/inet/gethstbynm_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -40,6 +40,6 @@
 #define HAVE_LOOKUP_BUFFER	1
 
 /* Special name for the lookup function.  */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
 
 #include "../nss/getXXbyYY_r.c"

Modified: fsf/trunk/libc/inet/gethstent_r.c
==============================================================================
--- fsf/trunk/libc/inet/gethstent_r.c (original)
+++ fsf/trunk/libc/inet/gethstent_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,6 +30,6 @@
 #define NEED__RES	1
 
 /* Special name for the lookup function.  */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
+#define DB_LOOKUP_FCT __nss_hosts_lookup2
 
 #include "../nss/getXXent_r.c"

Modified: fsf/trunk/libc/inet/getnetgrent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getnetgrent_r.c (original)
+++ fsf/trunk/libc/inet/getnetgrent_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2004, 2005
+/* Copyright (C) 1996, 1997, 1998, 1999, 2002, 2004, 2005, 2007
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -18,13 +18,16 @@
    02111-1307 USA.  */
 
 #include <assert.h>
+#include <atomic.h>
 #include <bits/libc-lock.h>
 #include <errno.h>
 #include <netdb.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include "netgroup.h"
 #include "nsswitch.h"
+#include <sysdep.h>
 
 
 /* Protect above variable against multiple uses at the same time.  */
@@ -44,25 +47,32 @@
 setup (void **fctp, service_user **nipp)
 {
   /* Remember the first service_entry, it's always the same.  */
+  static bool startp_initialized;
   static service_user *startp;
   int no_more;
 
-  if (startp == NULL)
+  if (!startp_initialized)
     {
       /* Executing this more than once at the same time must yield the
 	 same result every time.  So we need no locking.  */
       no_more = __nss_netgroup_lookup (nipp, "setnetgrent", fctp);
       startp = no_more ? (service_user *) -1 : *nipp;
-    }
-  else if (startp == (service_user *) -1)
-    /* No services at all.  */
-    return 1;
+      PTR_MANGLE (startp);
+      atomic_write_barrier ();
+      startp_initialized = true;
+    }
   else
     {
+      service_user *nip = startp;
+      PTR_DEMANGLE (nip);
+      if (nip == (service_user *) -1)
+	/* No services at all.  */
+	return 1;
+
       /* Reset to the beginning of the service list.  */
-      *nipp = startp;
+      *nipp = nip;
       /* Look up the first function.  */
-      no_more = __nss_lookup (nipp, "setnetgrent", fctp);
+      no_more = __nss_lookup (nipp, "setnetgrent", NULL, fctp);
     }
   return no_more;
 }
@@ -122,11 +132,12 @@
     {
       assert (datap->data == NULL);
 
-      /* Ignore status, we force check in `__nss_next'.  */
+      /* Ignore status, we force check in `__nss_next2'.  */
       status = (*fct.f) (group, datap);
 
       service_user *old_nip = datap->nip;
-      no_more = __nss_next (&datap->nip, "setnetgrent", &fct.ptr, status, 0);
+      no_more = __nss_next2 (&datap->nip, "setnetgrent", NULL, &fct.ptr,
+			     status, 0);
 
       if (status == NSS_STATUS_SUCCESS && ! no_more)
 	{
@@ -423,8 +434,8 @@
 	    break;
 
 	  /* Look for the next service.  */
-	  no_more = __nss_next (&entry.nip, "setnetgrent",
-				&setfct.ptr, status, 0);
+	  no_more = __nss_next2 (&entry.nip, "setnetgrent", NULL,
+				 &setfct.ptr, status, 0);
 	}
 
       if (result == 0 && entry.needed_groups != NULL)

Modified: fsf/trunk/libc/nscd/Makefile
==============================================================================
--- fsf/trunk/libc/nscd/Makefile (original)
+++ fsf/trunk/libc/nscd/Makefile Tue Oct 30 00:02:49 2007
@@ -32,7 +32,7 @@
 vpath %.c ../locale/programs
 
 nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \
-		getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm2_r \
+		getgrnam_r getgrgid_r hstcache gethstbyad_r gethstbynm3_r \
 		getsrvbynm_r getsrvbypt_r servicescache \
 		dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \
 		xmalloc xstrdup aicache initgrcache gai res_hconf
@@ -106,7 +106,7 @@
 CFLAGS-getgrgid_r.c += $(nscd-cflags)
 CFLAGS-hstcache.c += $(nscd-cflags)
 CFLAGS-gethstbyad_r.c += $(nscd-cflags)
-CFLAGS-gethstbynm2_r.c += $(nscd-cflags)
+CFLAGS-gethstbynm3_r.c += $(nscd-cflags)
 CFLAGS-dbg_log.c += $(nscd-cflags)
 CFLAGS-nscd_conf.c += $(nscd-cflags)
 CFLAGS-nscd_stat.c += $(nscd-cflags)

Modified: fsf/trunk/libc/nscd/aicache.c
==============================================================================
--- fsf/trunk/libc/nscd/aicache.c (original)
+++ fsf/trunk/libc/nscd/aicache.c Tue Oct 30 00:02:49 2007
@@ -110,7 +110,7 @@
   size_t tmpbuf4len = 0;
   char *tmpbuf4 = NULL;
   char *canon = NULL;
-  int32_t ttl = UINT32_MAX;
+  int32_t ttl = INT32_MAX;
   ssize_t total = 0;
   char *key_copy = NULL;
   bool alloca_used = false;
@@ -163,7 +163,7 @@
 	      rc4 = 0;
 	      status[1] = DL_CALL_FCT (fct, (key, AF_INET, &th[1], tmpbuf4,
 					     tmpbuf4len, &rc4, &herrno,
-					     ttl == UINT32_MAX ? &ttl : NULL,
+					     ttl == INT32_MAX ? &ttl : NULL,
 					     canon == NULL ? &canon : NULL));
 	      if (rc4 != ERANGE || herrno != NETDB_INTERNAL)
 		break;
@@ -233,9 +233,9 @@
 		      int rc;
 		      while (1)
 			{
-			  rc = __gethostbyaddr_r (addr, addrlen, addrfamily,
-						  &he_mem, tmpbuf, tmpbuflen,
-						  &he, &herrno);
+			  rc = __gethostbyaddr2_r (addr, addrlen, addrfamily,
+						   &he_mem, tmpbuf, tmpbuflen,
+						   &he, &herrno, NULL);
 			  if (rc != ERANGE || herrno != NETDB_INTERNAL)
 			    break;
 			  tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
@@ -285,7 +285,8 @@
 	      dataset->head.usable = true;
 
 	      /* Compute the timeout time.  */
-	      dataset->head.timeout = time (NULL) + MIN (db->postimeout, ttl);
+	      dataset->head.timeout = time (NULL) + (ttl == INT32_MAX
+						     ? db->postimeout : ttl);
 
 	      dataset->resp.version = NSCD_VERSION;
 	      dataset->resp.found = 1;

Modified: fsf/trunk/libc/nscd/gethstbyad_r.c
==============================================================================
--- fsf/trunk/libc/nscd/gethstbyad_r.c (original)
+++ fsf/trunk/libc/nscd/gethstbyad_r.c Tue Oct 30 00:02:49 2007
@@ -20,12 +20,25 @@
 
 
 #define LOOKUP_TYPE	struct hostent
-#define FUNCTION_NAME	gethostbyaddr
+#define FUNCTION_NAME	gethostbyaddr2
+#define FUNCTION2_NAME	gethostbyaddr
 #define DATABASE_NAME	hosts
 #define ADD_PARAMS	const void *addr, socklen_t len, int type
+#define EXTRA_PARAMS	, int32_t *ttlp
 #define ADD_VARIABLES	addr, len, type
+#define EXTRA_VARIABLES , ttlp
 #define NEED_H_ERRNO	1
 #define NEED__RES	1
 #define NEED__RES_HCONF 1
 
 #include "../nss/getXXbyYY_r.c"
+
+
+int
+__gethostbyaddr_r (const void *addr, socklen_t len, int type,
+		   struct hostent *result_buf, char *buf, size_t buflen,
+		   struct hostent **result, int *h_errnop)
+{
+  return __gethostbyaddr2_r (addr, len, type, result_buf, buf, buflen,
+			     result, h_errnop, NULL);
+}

Added: fsf/trunk/libc/nscd/gethstbynm3_r.c
==============================================================================
--- fsf/trunk/libc/nscd/gethstbynm3_r.c (added)
+++ fsf/trunk/libc/nscd/gethstbynm3_r.c Tue Oct 30 00:02:49 2007
@@ -1,0 +1,53 @@
+/* Copyright (C) 1996-1998, 2000, 2005, 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation; version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+#include <ctype.h>
+#include <errno.h>
+#include <netdb.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+#define LOOKUP_TYPE	struct hostent
+#define FUNCTION_NAME	gethostbyname3
+#define FUNCTION2_NAME	gethostbyname2
+#define DATABASE_NAME	hosts
+#define ADD_PARAMS	const char *name, int af
+#define EXTRA_PARAMS	, int32_t *ttlp, char **canonp
+#define ADD_VARIABLES	name, af
+#define EXTRA_VARIABLES	, ttlp, canonp
+#define NEED_H_ERRNO	1
+#define NEED__RES_HCONF 1
+
+#define HANDLE_DIGITS_DOTS	1
+#define HAVE_LOOKUP_BUFFER	1
+#define HAVE_AF			1
+
+#define __inet_aton inet_aton
+
+#include "../nss/getXXbyYY_r.c"
+
+
+int
+__gethostbyname2_r (const char *name, int af, struct hostent *ret, char *buf,
+		    size_t buflen, struct hostent **result, int *h_errnop)
+{
+  return __gethostbyname3_r (name, af, ret, buf, buflen, result, h_errnop,
+			     NULL, NULL);
+}

Modified: fsf/trunk/libc/nscd/hstcache.c
==============================================================================
--- fsf/trunk/libc/nscd/hstcache.c (original)
+++ fsf/trunk/libc/nscd/hstcache.c Tue Oct 30 00:02:49 2007
@@ -80,7 +80,8 @@
 static void
 cache_addhst (struct database_dyn *db, int fd, request_header *req,
 	      const void *key, struct hostent *hst, uid_t owner,
-	      struct hashentry *he, struct datahead *dh, int errval)
+	      struct hashentry *he, struct datahead *dh, int errval,
+	      int32_t ttl)
 {
   ssize_t total;
   ssize_t written;
@@ -131,7 +132,8 @@
 	      dataset->head.usable = true;
 
 	      /* Compute the timeout time.  */
-	      dataset->head.timeout = t + db->negtimeout;
+	      dataset->head.timeout = t + (ttl == INT32_MAX
+					   ? db->negtimeout : ttl);
 
 	      /* This is the reply.  */
 	      memcpy (&dataset->resp, &notfound, total);
@@ -247,7 +249,7 @@
       dataset->head.usable = true;
 
       /* Compute the timeout time.  */
-      dataset->head.timeout = t + db->postimeout;
+      dataset->head.timeout = t + (ttl == INT32_MAX ? db->postimeout : ttl);
 
       dataset->resp.version = NSCD_VERSION;
       dataset->resp.found = 1;
@@ -423,19 +425,19 @@
 
 static int
 lookup (int type, void *key, struct hostent *resultbufp, char *buffer,
-	size_t buflen, struct hostent **hst)
+	size_t buflen, struct hostent **hst, int32_t *ttlp)
 {
   if (type == GETHOSTBYNAME)
-    return __gethostbyname2_r (key, AF_INET, resultbufp, buffer, buflen, hst,
-			       &h_errno);
+    return __gethostbyname3_r (key, AF_INET, resultbufp, buffer, buflen, hst,
+			       &h_errno, ttlp, NULL);
   if (type == GETHOSTBYNAMEv6)
-    return __gethostbyname2_r (key, AF_INET6, resultbufp, buffer, buflen, hst,
-			       &h_errno);
+    return __gethostbyname3_r (key, AF_INET6, resultbufp, buffer, buflen, hst,
+			       &h_errno, ttlp, NULL);
   if (type == GETHOSTBYADDR)
-    return __gethostbyaddr_r (key, NS_INADDRSZ, AF_INET, resultbufp, buffer,
-			      buflen, hst, &h_errno);
-  return __gethostbyaddr_r (key, NS_IN6ADDRSZ, AF_INET6, resultbufp, buffer,
-			    buflen, hst, &h_errno);
+    return __gethostbyaddr2_r (key, NS_INADDRSZ, AF_INET, resultbufp, buffer,
+			       buflen, hst, &h_errno, ttlp);
+  return __gethostbyaddr2_r (key, NS_IN6ADDRSZ, AF_INET6, resultbufp, buffer,
+			     buflen, hst, &h_errno, ttlp);
 }
 
 
@@ -453,6 +455,7 @@
   struct hostent *hst;
   bool use_malloc = false;
   int errval = 0;
+  int32_t ttl = INT32_MAX;
 
   if (__builtin_expect (debug_level > 0, 0))
     {
@@ -470,7 +473,7 @@
 	dbg_log (_("Reloading \"%s\" in hosts cache!"), (char *) str);
     }
 
-  while (lookup (req->type, key, &resultbuf, buffer, buflen, &hst) != 0
+  while (lookup (req->type, key, &resultbuf, buffer, buflen, &hst, &ttl) != 0
 	 && h_errno == NETDB_INTERNAL
 	 && (errval = errno) == ERANGE)
     {
@@ -504,7 +507,7 @@
     }
 
   cache_addhst (db, fd, req, key, hst, uid, he, dh,
-		h_errno == TRY_AGAIN ? errval : 0);
+		h_errno == TRY_AGAIN ? errval : 0, ttl);
 
   if (use_malloc)
     free (buffer);

Modified: fsf/trunk/libc/nss/Versions
==============================================================================
--- fsf/trunk/libc/nss/Versions (original)
+++ fsf/trunk/libc/nss/Versions Tue Oct 30 00:02:49 2007
@@ -9,7 +9,10 @@
   }
   GLIBC_PRIVATE {
     _nss_files_parse_grent; _nss_files_parse_pwent; _nss_files_parse_spent;
-    __nss_disable_nscd; __nss_lookup_function; __nss_services_lookup;
+    __nss_disable_nscd; __nss_lookup_function;
+
+    __nss_passwd_lookup2; __nss_group_lookup2; __nss_hosts_lookup2;
+    __nss_services_lookup2; __nss_next2;
   }
 }
 

Modified: fsf/trunk/libc/nss/XXX-lookup.c
==============================================================================
--- fsf/trunk/libc/nss/XXX-lookup.c (original)
+++ fsf/trunk/libc/nss/XXX-lookup.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -34,7 +34,8 @@
 |* 								   *|
 \*******************************************************************/
 
-#define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
+#define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup2)
+#define DB_COMPAT_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
 #define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post)
 #define CONCAT3_2(Pre, Name, Post) Pre##Name##Post
 
@@ -56,12 +57,14 @@
 service_user *DATABASE_NAME_SYMBOL attribute_hidden;
 
 extern int DB_LOOKUP_FCT (service_user **ni, const char *fct_name,
-			  void **fctp) internal_function;
+			  const char *fct2_name, void **fctp)
+  internal_function;
 libc_hidden_proto (DB_LOOKUP_FCT)
 
 int
 internal_function
-DB_LOOKUP_FCT (service_user **ni, const char *fct_name, void **fctp)
+DB_LOOKUP_FCT (service_user **ni, const char *fct_name, const char *fct2_name,
+	       void **fctp)
 {
   if (DATABASE_NAME_SYMBOL == NULL
       && __nss_database_lookup (DATABASE_NAME_STRING, ALTERNATE_NAME_STRING,
@@ -70,6 +73,16 @@
 
   *ni = DATABASE_NAME_SYMBOL;
 
-  return __nss_lookup (ni, fct_name, fctp);
+  return __nss_lookup (ni, fct_name, fct2_name, fctp);
 }
 libc_hidden_def (DB_LOOKUP_FCT)
+
+
+#ifndef NO_COMPAT
+int
+internal_function attribute_compat_text_section
+DB_COMPAT_FCT (service_user **ni, const char *fct_name, void **fctp)
+{
+  return DB_LOOKUP_FCT (ni, fct_name, NULL, fctp);
+}
+#endif

Modified: fsf/trunk/libc/nss/getXXbyYY_r.c
==============================================================================
--- fsf/trunk/libc/nss/getXXbyYY_r.c (original)
+++ fsf/trunk/libc/nss/getXXbyYY_r.c Tue Oct 30 00:02:49 2007
@@ -42,11 +42,17 @@
 |* DATABASE_NAME - name of the database the function accesses	   *|
 |*		   (e.g., host, services, ...)			   *|
 |*								   *|
-|* ADD_PARAMS    - additional parameter, can vary in number	   *|
-|*								   *|
-|* ADD_VARIABLES - names of additional parameter		   *|
+|* ADD_PARAMS    - additional parameters, can vary in number	   *|
+|*								   *|
+|* ADD_VARIABLES - names of additional parameters		   *|
 |*								   *|
 |* Optionally the following vars can be defined:		   *|
+|*								   *|
+|* EXTRA_PARAMS  - optional parameters, can vary in number	   *|
+|*								   *|
+|* EXTRA_VARIABLES - names of optional parameter		   *|
+|*								   *|
+|* FUNCTION_NAME - alternative name of the non-reentrant function  *|
 |*								   *|
 |* NEED_H_ERRNO  - an extra parameter will be passed to point to   *|
 |*		   the global `h_errno' variable.		   *|
@@ -62,6 +68,11 @@
 
 /* To make the real sources a bit prettier.  */
 #define REENTRANT_NAME APPEND_R (FUNCTION_NAME)
+#ifdef FUNCTION2_NAME
+# define REENTRANT2_NAME APPEND_R (FUNCTION2_NAME)
+#else
+# define REENTRANT2_NAME NULL
+#endif
 #define APPEND_R(name) APPEND_R1 (name)
 #define APPEND_R1(name) name##_r
 #define INTERNAL(name) INTERNAL1 (name)
@@ -80,12 +91,17 @@
 
 #define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME)
 #define REENTRANT_NAME_STRING STRINGIZE (REENTRANT_NAME)
+#ifdef FUNCTION2_NAME
+# define REENTRANT2_NAME_STRING STRINGIZE (REENTRANT2_NAME)
+#else
+# define REENTRANT2_NAME_STRING NULL
+#endif
 #define DATABASE_NAME_STRING STRINGIZE (DATABASE_NAME)
 #define STRINGIZE(name) STRINGIZE1 (name)
 #define STRINGIZE1(name) #name
 
 #ifndef DB_LOOKUP_FCT
-# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
+# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup2)
 # define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post)
 # define CONCAT3_2(Pre, Name, Post) Pre##Name##Post
 #endif
@@ -101,6 +117,13 @@
 # define H_ERRNO_VAR_P NULL
 #endif
 
+#ifndef EXTRA_PARAMS
+# define EXTRA_PARAMS
+#endif
+#ifndef EXTRA_VARIABLES
+# define EXTRA_VARIABLES
+#endif
+
 #ifdef HAVE_AF
 # define AF_VAL af
 #else
@@ -109,17 +132,20 @@
 
 /* Type of the lookup function we need here.  */
 typedef enum nss_status (*lookup_function) (ADD_PARAMS, LOOKUP_TYPE *, char *,
-					    size_t, int * H_ERRNO_PARM);
+					    size_t, int * H_ERRNO_PARM
+					    EXTRA_PARAMS);
 
 /* The lookup function for the first entry of this service.  */
-extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp)
+extern int DB_LOOKUP_FCT (service_user **nip, const char *name,
+			  const char *name2, void **fctp)
      internal_function;
 libc_hidden_proto (DB_LOOKUP_FCT)
 
 
 int
 INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
-			   size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM)
+			   size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM
+			   EXTRA_PARAMS)
 {
   static bool startp_initialized;
   static service_user *startp;
@@ -171,7 +197,8 @@
 
   if (! startp_initialized)
     {
-      no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING, &fct.ptr);
+      no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING,
+			       REENTRANT2_NAME_STRING, &fct.ptr);
       if (no_more)
 	{
 	  void *tmp_ptr = (service_user *) -1l;
@@ -224,7 +251,7 @@
 #endif
 
       status = DL_CALL_FCT (fct.l, (ADD_VARIABLES, resbuf, buffer, buflen,
-				    &errno H_ERRNO_VAR));
+				    &errno H_ERRNO_VAR EXTRA_VARIABLES));
 
       /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
 	 provided buffer is too small.  In this case we should give
@@ -238,8 +265,8 @@
 	  && errno == ERANGE)
 	break;
 
-      no_more = __nss_next (&nip, REENTRANT_NAME_STRING,
-			    &fct.ptr, status, 0);
+      no_more = __nss_next2 (&nip, REENTRANT_NAME_STRING,
+			     REENTRANT2_NAME_STRING, &fct.ptr, status, 0);
     }
 
 #ifdef HANDLE_DIGITS_DOTS
@@ -274,10 +301,11 @@
 }
 
 
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2)
-#define OLD(name) OLD1 (name)
-#define OLD1(name) __old_##name
+#ifndef FUNCTION2_NAME
+# include <shlib-compat.h>
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2)
+#  define OLD(name) OLD1 (name)
+#  define OLD1(name) __old_##name
 
 int
 attribute_compat_text_section
@@ -293,19 +321,20 @@
   return ret;
 }
 
-#define do_symbol_version(real, name, version) \
+#  define do_symbol_version(real, name, version) \
   compat_symbol (libc, real, name, version)
 do_symbol_version (OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2_0);
-#endif
+# endif
 
 /* As INTERNAL (REENTRANT_NAME) may be hidden, we need an alias
    in between so that the REENTRANT_NAME@@GLIBC_2.1.2 is not
    hidden too.  */
 strong_alias (INTERNAL (REENTRANT_NAME), NEW (REENTRANT_NAME));
 
-#define do_default_symbol_version(real, name, version) \
+# define do_default_symbol_version(real, name, version) \
   versioned_symbol (libc, real, name, version)
 do_default_symbol_version (NEW (REENTRANT_NAME),
 			   REENTRANT_NAME, GLIBC_2_1_2);
+#endif
 
 static_link_warning (REENTRANT_NAME)

Modified: fsf/trunk/libc/nss/getXXent_r.c
==============================================================================
--- fsf/trunk/libc/nss/getXXent_r.c (original)
+++ fsf/trunk/libc/nss/getXXent_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996,97,98,99,2000,2002,2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000,2002,2004,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -64,7 +64,7 @@
 #define STRINGIZE1(Name) #Name
 
 #ifndef DB_LOOKUP_FCT
-# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
+# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup2)
 # define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post)
 # define CONCAT3_2(Pre, Name, Post) Pre##Name##Post
 #endif
@@ -113,7 +113,8 @@
 __libc_lock_define_initialized (static, lock)
 
 /* The lookup function for the first entry of this service.  */
-extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp)
+extern int DB_LOOKUP_FCT (service_user **nip, const char *name,
+			  const char *name2, void **fctp)
      internal_function;
 libc_hidden_proto (DB_LOOKUP_FCT)
 

Modified: fsf/trunk/libc/nss/getnssent_r.c
==============================================================================
--- fsf/trunk/libc/nss/getnssent_r.c (original)
+++ fsf/trunk/libc/nss/getnssent_r.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@
   int no_more;
   if (*startp == NULL)
     {
-      no_more = lookup_fct (nip, func_name, fctp);
+      no_more = lookup_fct (nip, func_name, NULL, fctp);
       *startp = no_more ? (service_user *) -1l : *nip;
     }
   else if (*startp == (service_user *) -1l)
@@ -42,7 +42,7 @@
 	/* Reset to the beginning of the service list.  */
 	*nip = *startp;
       /* Look up the first function.  */
-      no_more = __nss_lookup (nip, func_name, fctp);
+      no_more = __nss_lookup (nip, func_name, NULL, fctp);
     }
   return no_more;
 }
@@ -80,8 +80,7 @@
       else
 	status = DL_CALL_FCT (fct.f, (0));
 
-      no_more = __nss_next (nip, func_name, &fct.ptr,
-			    status, 0);
+      no_more = __nss_next2 (nip, func_name, NULL, &fct.ptr, status, 0);
       if (is_last_nip)
 	*last_nip = *nip;
     }
@@ -120,7 +119,7 @@
 	/* We have processed all services which were used.  */
 	break;
 
-      no_more = __nss_next (nip, func_name, &fct.ptr, 0, 1);
+      no_more = __nss_next2 (nip, func_name, NULL, &fct.ptr, 0, 1);
     }
   *last_nip = *nip = NULL;
 }
@@ -177,8 +176,8 @@
 
       do
 	{
-	  no_more = __nss_next (nip, getent_func_name, &fct.ptr,
-				status, 0);
+	  no_more = __nss_next2 (nip, getent_func_name, NULL, &fct.ptr,
+				 status, 0);
 
 	  if (is_last_nip)
 	    *last_nip = *nip;
@@ -192,8 +191,7 @@
 		void *ptr;
 	      } sfct;
 
-	      no_more = __nss_lookup (nip, setent_func_name,
-				      &sfct.ptr);
+	      no_more = __nss_lookup (nip, setent_func_name, NULL, &sfct.ptr);
 
 	      if (! no_more)
 	        {

Modified: fsf/trunk/libc/nss/nsswitch.c
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.c (original)
+++ fsf/trunk/libc/nss/nsswitch.c Tue Oct 30 00:02:49 2007
@@ -145,9 +145,12 @@
     0 == function found
     1 == finished */
 int
-__nss_lookup (service_user **ni, const char *fct_name, void **fctp)
+__nss_lookup (service_user **ni, const char *fct_name, const char *fct2_name,
+	      void **fctp)
 {
   *fctp = __nss_lookup_function (*ni, fct_name);
+  if (*fctp == NULL && fct2_name != NULL)
+    *fctp = __nss_lookup_function (*ni, fct_name);
 
   while (*fctp == NULL
 	 && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE
@@ -156,6 +159,8 @@
       *ni = (*ni)->next;
 
       *fctp = __nss_lookup_function (*ni, fct_name);
+      if (*fctp == NULL && fct2_name != NULL)
+	*fctp = __nss_lookup_function (*ni, fct_name);
     }
 
   return *fctp != NULL ? 0 : (*ni)->next == NULL ? 1 : -1;
@@ -166,8 +171,8 @@
     0 == adjusted for next function
     1 == finished */
 int
-__nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
-	    int all_values)
+__nss_next2 (service_user **ni, const char *fct_name, const char *fct2_name,
+	     void **fctp, int status, int all_values)
 {
   if (all_values)
     {
@@ -180,7 +185,8 @@
   else
     {
       /* This is really only for debugging.  */
-       if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
+      if (__builtin_expect (NSS_STATUS_TRYAGAIN > status
+			    || status > NSS_STATUS_RETURN, 0))
 	 __libc_fatal ("illegal status in __nss_next");
 
        if (nss_next_action (*ni, status) == NSS_ACTION_RETURN)
@@ -195,6 +201,8 @@
       *ni = (*ni)->next;
 
       *fctp = __nss_lookup_function (*ni, fct_name);
+      if (*fctp == NULL && fct2_name != NULL)
+	*fctp = __nss_lookup_function (*ni, fct2_name);
     }
   while (*fctp == NULL
 	 && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE
@@ -202,7 +210,16 @@
 
   return *fctp != NULL ? 0 : -1;
 }
-libc_hidden_def (__nss_next)
+libc_hidden_def (__nss_next2)
+
+
+int
+attribute_compat_text_section
+__nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
+	    int all_values)
+{
+  return __nss_next2 (ni, fct_name, NULL, fctp, status, all_values);
+}
 
 
 int

Modified: fsf/trunk/libc/nss/nsswitch.h
==============================================================================
--- fsf/trunk/libc/nss/nsswitch.h (original)
+++ fsf/trunk/libc/nss/nsswitch.h Tue Oct 30 00:02:49 2007
@@ -110,7 +110,8 @@
 /* Put first function with name FCT_NAME for SERVICE in FCTP.  The
    position is remembered in NI.  The function returns a value < 0 if
    an error occurred or no such function exists.  */
-extern int __nss_lookup (service_user **ni, const char *fct_name, void **fctp);
+extern int __nss_lookup (service_user **ni, const char *fct_name,
+			 const char *fct2_name, void **fctp) attribute_hidden;
 
 /* Determine the next step in the lookup process according to the
    result STATUS of the call to the last function returned by
@@ -125,9 +126,12 @@
    services.  In other words, only if all four lookup results have
    the action RETURN associated the lookup process stops before the
    natural end.  */
+extern int __nss_next2 (service_user **ni, const char *fct_name,
+			const char *fct2_name, void **fctp, int status,
+			int all_values) attribute_hidden;
+libc_hidden_proto (__nss_next2)
 extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
 		       int status, int all_values);
-libc_hidden_proto (__nss_next)
 
 /* Search for the service described in NI for a function named FCT_NAME
    and return a pointer to this function if successful.  */
@@ -139,7 +143,8 @@
 extern void __nss_disable_nscd (void);
 
 
-typedef int (*db_lookup_function) (service_user **, const char *, void **)
+typedef int (*db_lookup_function) (service_user **, const char *, const char *,
+				   void **)
      internal_function;
 typedef enum nss_status (*setent_function) (int);
 typedef enum nss_status (*endent_function) (void);

Modified: fsf/trunk/libc/nss/service-lookup.c
==============================================================================
--- fsf/trunk/libc/nss/service-lookup.c (original)
+++ fsf/trunk/libc/nss/service-lookup.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -18,5 +18,6 @@
    02111-1307 USA.  */
 
 #define DATABASE_NAME services
+#define NO_COMPAT
 
 #include "XXX-lookup.c"

Modified: fsf/trunk/libc/resolv/Versions
==============================================================================
--- fsf/trunk/libc/resolv/Versions (original)
+++ fsf/trunk/libc/resolv/Versions Tue Oct 30 00:02:49 2007
@@ -88,6 +88,7 @@
     _nss_dns_gethostbyname3_r;
     _nss_dns_gethostbyname_r; _nss_dns_getnetbyaddr_r;
     _nss_dns_getnetbyname_r; _nss_dns_getcanonname_r;
+    _nss_dns_gethostbyaddr2_r;
   }
 }
 

Modified: fsf/trunk/libc/resolv/nss_dns/dns-host.c
==============================================================================
--- fsf/trunk/libc/resolv/nss_dns/dns-host.c (original)
+++ fsf/trunk/libc/resolv/nss_dns/dns-host.c Tue Oct 30 00:02:49 2007
@@ -255,10 +255,18 @@
 }
 
 
+extern enum nss_status _nss_dns_gethostbyaddr2_r (const void *addr,
+						  socklen_t len, int af,
+						  struct hostent *result,
+						  char *buffer, size_t buflen,
+						  int *errnop, int *h_errnop,
+						  int32_t *ttlp);
+hidden_proto (_nss_dns_gethostbyaddr2_r)
+
 enum nss_status
-_nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af,
-			  struct hostent *result, char *buffer, size_t buflen,
-			  int *errnop, int *h_errnop)
+_nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
+			   struct hostent *result, char *buffer, size_t buflen,
+			   int *errnop, int *h_errnop, int32_t *ttlp)
 {
   static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
   static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
@@ -374,7 +382,7 @@
 
  got_it_already:
   status = getanswer_r (host_buffer.buf, n, qbuf, T_PTR, result, buffer, buflen,
-			errnop, h_errnop, 0 /* XXX */, NULL, NULL);
+			errnop, h_errnop, 0 /* XXX */, ttlp, NULL);
   if (host_buffer.buf != orig_host_buffer)
     free (host_buffer.buf);
   if (status != NSS_STATUS_SUCCESS)
@@ -407,6 +415,17 @@
 #endif
   *h_errnop = NETDB_SUCCESS;
   return NSS_STATUS_SUCCESS;
+}
+hidden_def (_nss_dns_gethostbyaddr2_r)
+
+
+enum nss_status
+_nss_dns_gethostbyaddr_r (const void *addr, socklen_t len, int af,
+			  struct hostent *result, char *buffer, size_t buflen,
+			  int *errnop, int *h_errnop)
+{
+  return _nss_dns_gethostbyaddr2_r (addr, len, af, result, buffer, buflen,
+				    errnop, h_errnop, NULL);
 }
 
 #ifdef RESOLVSORT

Modified: fsf/trunk/libc/sunrpc/netname.c
==============================================================================
--- fsf/trunk/libc/sunrpc/netname.c (original)
+++ fsf/trunk/libc/sunrpc/netname.c Tue Oct 30 00:02:49 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxxxxxxxxxxxxxx>, 1997.
 
@@ -176,7 +176,7 @@
     {
       status = (*fct.f) (netname, uidp, gidp, gidlenp, gidlist);
 
-      no_more = __nss_next (&nip, "netname2user", &fct.ptr, status, 0);
+      no_more = __nss_next2 (&nip, "netname2user", NULL, &fct.ptr, status, 0);
     }
 
   return status == NSS_STATUS_SUCCESS;

Modified: fsf/trunk/libc/sunrpc/publickey.c
==============================================================================
--- fsf/trunk/libc/sunrpc/publickey.c (original)
+++ fsf/trunk/libc/sunrpc/publickey.c Tue Oct 30 00:02:49 2007
@@ -1,5 +1,5 @@
 /* Get public or secret key from key server.
-   Copyright (C) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1996-1999,2002,2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -71,7 +71,7 @@
     {
       status = (*fct.f) (name, key, &errno);
 
-      no_more = __nss_next (&nip, "getpublickey", &fct.ptr, status, 0);
+      no_more = __nss_next2 (&nip, "getpublickey", NULL, &fct.ptr, status, 0);
     }
 
   return status == NSS_STATUS_SUCCESS;
@@ -114,7 +114,7 @@
     {
       status = (*fct.f) (name, key, passwd, &errno);
 
-      no_more = __nss_next (&nip, "getsecretkey", &fct.ptr, status, 0);
+      no_more = __nss_next2 (&nip, "getsecretkey", NULL, &fct.ptr, status, 0);
     }
 
   return status == NSS_STATUS_SUCCESS;