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

[commits] r14287 - in /fsf/trunk/libc: ChangeLog NEWS inet/getnetgrent_r.c nss/nss_db/db-XXX.c sysdeps/posix/getaddrinfo.c



Author: eglibc
Date: Wed Jun 22 00:02:58 2011
New Revision: 14287

Log:
Import glibc-mainline for 2011-06-22

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/inet/getnetgrent_r.c
    fsf/trunk/libc/nss/nss_db/db-XXX.c
    fsf/trunk/libc/sysdeps/posix/getaddrinfo.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Jun 22 00:02:58 2011
@@ -1,3 +1,17 @@
+2011-06-21  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* nss/nss_db/db-XXX.c (nss_db_setENT): Only set entidx for successful
+	calls to internal_setent.
+
+	[BZ #12885]
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): When looking up only IPv6
+	addresses using gethostbyname4_r ignore IPv4 addresses.
+
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): After the last change the
+	branch using gethostbyname2 is only for AF_INET.  Optimize accordingly.
+
+	* inet/getnetgrent_r.c: Use DL_CALL_FCT in several places.
+
 2011-06-20  David S. Miller  <davem@xxxxxxxxxxxxx>
 
 	* sysdeps/sparc/sparc32/dl-plt.h: Protect against multiple

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Wed Jun 22 00:02:58 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-6-15
+GNU C Library NEWS -- history of user-visible changes.  2011-6-21
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -6,6 +6,10 @@
 using `glibc' in the "product" field.
 
 Version 2.15
+
+* The following bugs are resolved with this release:
+
+  12885
 
 * New program pldd to list loaded object of a process
   Implemented by Ulrich Drepper.

Modified: fsf/trunk/libc/inet/getnetgrent_r.c
==============================================================================
--- fsf/trunk/libc/inet/getnetgrent_r.c (original)
+++ fsf/trunk/libc/inet/getnetgrent_r.c Wed Jun 22 00:02:58 2011
@@ -133,7 +133,7 @@
       assert (datap->data == NULL);
 
       /* Ignore status, we force check in `__nss_next2'.  */
-      status = (*fct.f) (group, datap);
+      status = DL_CALL_FCT (*fct.f, (group, datap));
 
       service_user *old_nip = datap->nip;
       no_more = __nss_next2 (&datap->nip, "setnetgrent", NULL, &fct.ptr,
@@ -145,7 +145,7 @@
 
 	  endfct = __nss_lookup_function (old_nip, "endnetgrent");
 	  if (endfct != NULL)
-	    (void) (*endfct) (datap);
+	    (void) DL_CALL_FCT (*endfct, (datap));
 	}
     }
 
@@ -244,7 +244,7 @@
 		    == NULL);
   while (! no_more)
     {
-      status = (*fct) (datap, buffer, buflen, &errno);
+      status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno));
 
       if (status == NSS_STATUS_RETURN)
 	{
@@ -362,7 +362,8 @@
 	  assert (entry.data == NULL);
 
 	  /* Open netgroup.  */
-	  enum nss_status status = (*setfct.f) (current_group, &entry);
+	  enum nss_status status = DL_CALL_FCT (*setfct.f,
+						(current_group, &entry));
 
 	  if (status == NSS_STATUS_SUCCESS
 	      && (getfct = __nss_lookup_function (entry.nip, "getnetgrent_r"))
@@ -370,7 +371,8 @@
 	    {
 	      char buffer[1024];
 
-	      while ((*getfct) (&entry, buffer, sizeof buffer, &errno)
+	      while (DL_CALL_FCT (*getfct,
+				  (&entry, buffer, sizeof buffer, &errno))
 		     == NSS_STATUS_SUCCESS)
 		{
 		  if (entry.type == group_val)
@@ -425,7 +427,7 @@
 	  /* Free all resources of the service.  */
 	  endfct = __nss_lookup_function (entry.nip, "endnetgrent");
 	  if (endfct != NULL)
-	    (*endfct) (&entry);
+	    DL_CALL_FCT (*endfct, (&entry));
 
 	  if (result != 0)
 	    break;

Modified: fsf/trunk/libc/nss/nss_db/db-XXX.c
==============================================================================
--- fsf/trunk/libc/nss/nss_db/db-XXX.c (original)
+++ fsf/trunk/libc/nss/nss_db/db-XXX.c Wed Jun 22 00:02:58 2011
@@ -71,11 +71,14 @@
 
   status = internal_setent (DBFILE, &state);
 
-  /* Remember STAYOPEN flag.  */
   if (status == NSS_STATUS_SUCCESS)
-    keep_db |= stayopen;
-  /* Reset the sequential index.  */
-  entidx  = (const char *) state.header + state.header->valstroffset;
+    {
+      /* Remember STAYOPEN flag.  */
+      keep_db |= stayopen;
+
+      /* Reset the sequential index.  */
+      entidx  = (const char *) state.header + state.header->valstroffset;
+    }
 
   __libc_lock_unlock (lock);
 

Modified: fsf/trunk/libc/sysdeps/posix/getaddrinfo.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/getaddrinfo.c (original)
+++ fsf/trunk/libc/sysdeps/posix/getaddrinfo.c Wed Jun 22 00:02:58 2011
@@ -565,7 +565,6 @@
 	     IPv6 scope ids. */
 	  if (req->ai_family == AF_INET)
 	    {
-	      int family = req->ai_family;
 	      size_t tmpbuflen = 512;
 	      assert (tmpbuf == NULL);
 	      tmpbuf = alloca_account (tmpbuflen, alloca_used);
@@ -576,7 +575,7 @@
 
 	      while (1)
 		{
-		  rc = __gethostbyname2_r (name, family, &th, tmpbuf,
+		  rc = __gethostbyname2_r (name, AF_INET, &th, tmpbuf,
 					   tmpbuflen, &h, &herrno);
 		  if (rc != ERANGE || herrno != NETDB_INTERNAL)
 		    break;
@@ -638,18 +637,9 @@
 			      (*pat)->scopeid = 0;
 			    }
 			  (*pat)->next = NULL;
-			  (*pat)->family = req->ai_family;
-			  if (family == req->ai_family)
-			    memcpy ((*pat)->addr, h->h_addr_list[i],
-				    h->h_length);
-			  else
-			    {
-			      uint32_t *addr = (uint32_t *) (*pat)->addr;
-			      addr[3] = *(uint32_t *) h->h_addr_list[i];
-			      addr[2] = htonl (0xffff);
-			      addr[1] = 0;
-			      addr[0] = 0;
-			    }
+			  (*pat)->family = AF_INET;
+			  memcpy ((*pat)->addr, h->h_addr_list[i],
+				  h->h_length);
 			  pat = &((*pat)->next);
 			}
 		    }
@@ -881,16 +871,44 @@
 			}
 		    }
 
-		  no_inet6_data = no_data;
-
 		  if (status == NSS_STATUS_SUCCESS)
 		    {
+		      assert (!no_data);
+		      no_data = 1;
+
 		      if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
 			canon = (*pat)->name;
 
 		      while (*pat != NULL)
-			pat = &((*pat)->next);
+			{
+			  if ((*pat)->family == AF_INET
+			      && req->ai_family == AF_INET6
+			      && (req->ai_flags & AI_V4MAPPED) != 0)
+			    {
+			      uint32_t *pataddr = (*pat)->addr;
+			      (*pat)->family = AF_INET6;
+			      pataddr[3] = pataddr[0];
+			      pataddr[2] = htonl (0xffff);
+			      pataddr[1] = 0;
+			      pataddr[0] = 0;
+			      pat = &((*pat)->next);
+			      no_data = 0;
+			    }
+			  else if ((*pat)->family == AF_UNSPEC
+				   || (*pat)->family == req->ai_family)
+			    {
+			      pat = &((*pat)->next);
+
+			      no_data = 0;
+			      if (req->ai_family == AF_INET6)
+				got_ipv6 = true;
+			    }
+			  else
+			    *pat = ((*pat)->next);
+			}
 		    }
+
+		  no_inet6_data = no_data;
 		}
 	      else
 		{