00db10
commit 3d04f5db20c8f0d1ba3881b5f5373586a18cf188
00db10
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
00db10
Date:   Tue May 21 21:54:41 2013 +0530
00db10
00db10
    Set EAI_SYSTEM only when h_errno is NETDB_INTERNAL
00db10
    
00db10
    Fixes BZ #15339.
00db10
    
00db10
    NSS_STATUS_UNAVAIL may mean that a necessary input resource is not
00db10
    available.  This could occur in a number of cases including when the
00db10
    network is down, system runs out of file descriptors, etc.  The
00db10
    correct differentiator in such a case is the h_errno, which gives the
00db10
    nature of failure.  In case of failures other than a simple 'not
00db10
    found', we set h_errno as NETDB_INTERNAL and let errno be the
00db10
    identifier for the exact error.
00db10
00db10
diff --git glibc-2.17-c758a686/nss/getXXbyYY_r.c glibc-2.17-c758a686/nss/getXXbyYY_r.c
00db10
index 44d00f4..33e63d4 100644
00db10
--- glibc-2.17-c758a686/nss/getXXbyYY_r.c
00db10
+++ glibc-2.17-c758a686/nss/getXXbyYY_r.c
00db10
@@ -287,10 +287,10 @@ done:
00db10
 #endif
00db10
   *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
00db10
 #ifdef NEED_H_ERRNO
00db10
-  if (status == NSS_STATUS_UNAVAIL)
00db10
-    /* Either we failed to lookup the functions or the functions themselves
00db10
-       had a system error.  Set NETDB_INTERNAL here to let the caller know
00db10
-       that the errno may have the real reason for failure.  */
00db10
+  if (status == NSS_STATUS_UNAVAIL && !any_service && errno != ENOENT)
00db10
+    /* This happens when we weren't able to use a service for reasons other
00db10
+       than the module not being found.  In such a case, we'd want to tell the
00db10
+       caller that errno has the real reason for failure.  */
00db10
       *h_errnop = NETDB_INTERNAL;
00db10
   else if (status != NSS_STATUS_SUCCESS && !any_service)
00db10
     /* We were not able to use any service.  */
00db10
diff --git glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
00db10
index ab135ad..7bb3ded 100644
00db10
--- glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
00db10
+++ glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
00db10
@@ -1036,7 +1036,15 @@ gaih_inet (const char *name, const struct gaih_service *service,
00db10
 			}
00db10
 		    }
00db10
 		  else
00db10
-		    status = NSS_STATUS_UNAVAIL;
00db10
+		    {
00db10
+		      status = NSS_STATUS_UNAVAIL;
00db10
+		      /* Could not load any of the lookup functions.  Indicate
00db10
+		         an internal error if the failure was due to a system
00db10
+			 error other than the file not being found.  We use the
00db10
+			 errno from the last failed callback.  */
00db10
+		      if (errno != 0 && errno != ENOENT)
00db10
+			__set_h_errno (NETDB_INTERNAL);
00db10
+		    }
00db10
 		}
00db10
 
00db10
 	      if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
00db10
@@ -1050,7 +1058,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
00db10
 
00db10
 	  _res.options |= old_res_options & RES_USE_INET6;
00db10
 
00db10
-	  if (status == NSS_STATUS_UNAVAIL)
00db10
+	  if (h_errno == NETDB_INTERNAL)
00db10
 	    {
00db10
 	      result = GAIH_OKIFUNSPEC | -EAI_SYSTEM;
00db10
 	      goto free_and_return;
00db10
_______________________________________________
00db10
glibc mailing list
00db10
glibc@lists.fedoraproject.org
00db10
https://admin.fedoraproject.org/mailman/listinfo/glibc