[glibc/f19] Set EAI_SYSTEM only when h_errno is NETDB_INTERNAL

Siddhesh Poyarekar siddhesh at fedoraproject.org
Thu Jun 20 09:15:11 UTC 2013


commit e84cca152958ff573a239488baa05a4c5b45d71c
Author: Siddhesh Poyarekar <siddhesh.poyarekar at gmail.com>
Date:   Thu Jun 20 13:52:27 2013 +0530

    Set EAI_SYSTEM only when h_errno is NETDB_INTERNAL

 glibc-rh958652.patch |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 glibc.spec           |    7 ++++-
 2 files changed, 75 insertions(+), 1 deletions(-)
---
diff --git a/glibc-rh958652.patch b/glibc-rh958652.patch
new file mode 100644
index 0000000..de10ded
--- /dev/null
+++ b/glibc-rh958652.patch
@@ -0,0 +1,69 @@
+commit 3d04f5db20c8f0d1ba3881b5f5373586a18cf188
+Author: Siddhesh Poyarekar <siddhesh at redhat.com>
+Date:   Tue May 21 21:54:41 2013 +0530
+
+    Set EAI_SYSTEM only when h_errno is NETDB_INTERNAL
+    
+    Fixes BZ #15339.
+    
+    NSS_STATUS_UNAVAIL may mean that a necessary input resource is not
+    available.  This could occur in a number of cases including when the
+    network is down, system runs out of file descriptors, etc.  The
+    correct differentiator in such a case is the h_errno, which gives the
+    nature of failure.  In case of failures other than a simple 'not
+    found', we set h_errno as NETDB_INTERNAL and let errno be the
+    identifier for the exact error.
+
+diff --git a/nss/getXXbyYY_r.c b/nss/getXXbyYY_r.c
+index 44d00f4..33e63d4 100644
+--- a/nss/getXXbyYY_r.c
++++ b/nss/getXXbyYY_r.c
+@@ -287,10 +287,10 @@ done:
+ #endif
+   *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
+ #ifdef NEED_H_ERRNO
+-  if (status == NSS_STATUS_UNAVAIL)
+-    /* Either we failed to lookup the functions or the functions themselves
+-       had a system error.  Set NETDB_INTERNAL here to let the caller know
+-       that the errno may have the real reason for failure.  */
++  if (status == NSS_STATUS_UNAVAIL && !any_service && errno != ENOENT)
++    /* This happens when we weren't able to use a service for reasons other
++       than the module not being found.  In such a case, we'd want to tell the
++       caller that errno has the real reason for failure.  */
+       *h_errnop = NETDB_INTERNAL;
+   else if (status != NSS_STATUS_SUCCESS && !any_service)
+     /* We were not able to use any service.  */
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index ab135ad..7bb3ded 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -1036,7 +1036,15 @@ gaih_inet (const char *name, const struct gaih_service *service,
+ 			}
+ 		    }
+ 		  else
+-		    status = NSS_STATUS_UNAVAIL;
++		    {
++		      status = NSS_STATUS_UNAVAIL;
++		      /* Could not load any of the lookup functions.  Indicate
++		         an internal error if the failure was due to a system
++			 error other than the file not being found.  We use the
++			 errno from the last failed callback.  */
++		      if (errno != 0 && errno != ENOENT)
++			__set_h_errno (NETDB_INTERNAL);
++		    }
+ 		}
+ 
+ 	      if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
+@@ -1050,7 +1058,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
+ 
+ 	  _res.options |= old_res_options & RES_USE_INET6;
+ 
+-	  if (status == NSS_STATUS_UNAVAIL)
++	  if (h_errno == NETDB_INTERNAL)
+ 	    {
+ 	      result = GAIH_OKIFUNSPEC | -EAI_SYSTEM;
+ 	      goto free_and_return;
+_______________________________________________
+glibc mailing list
+glibc at lists.fedoraproject.org
+https://admin.fedoraproject.org/mailman/listinfo/glibc
diff --git a/glibc.spec b/glibc.spec
index 76796c6..cb6a92c 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -27,7 +27,7 @@
 Summary: The GNU libc libraries
 Name: glibc
 Version: %{glibcversion}
-Release: 8%{?dist}
+Release: 9%{?dist}
 # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
 # Things that are linked directly into dynamically linked programs
 # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@@ -115,6 +115,7 @@ Patch0038: %{name}-rh959034.patch
 # Patches from upstream
 #
 Patch1000: %{name}-rh905877.patch
+Patch1001: %{name}-rh958652.patch
 
 #
 # Patches submitted, but not yet approved upstream.
@@ -413,6 +414,7 @@ package or when debugging this package.
 %patch1000 -p1
 %patch0038 -p1
 %patch2039 -p1
+%patch1001 -p1
 
 # On powerpc32, hp timing is only available in power4/power6
 # libs, not in base, so pre-power4 dynamic linker is incompatible
@@ -1208,6 +1210,9 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Thu Jun 20 2013 Siddhesh Poyarekar <siddhesh at redhat.com> - 2.17-9
+  - Set EAI_SYSTEM only when h_errno is NETDB_INTERNAL (#958652).
+
 * Tue Jun  4 2013 Jeff Law <law at redhat.com> - 2.17-8
   - Fix ESTALE error message (#966259)
 


More information about the scm-commits mailing list