diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-09-01 08:57:28 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2018-01-04 12:00:14 +0100 |
commit | 5515224932751ef13d382b7404fefc8e9c1057f5 (patch) | |
tree | b9a93534cee08646f5bb6ee754bf38a27a73798a | |
parent | dc2d4b0ccd317108e3fa6f77bbbad238b4b01920 (diff) | |
download | glibc-5515224932751ef13d382b7404fefc8e9c1057f5.tar.gz glibc-5515224932751ef13d382b7404fefc8e9c1057f5.tar.xz glibc-5515224932751ef13d382b7404fefc8e9c1057f5.zip |
getaddrinfo: Properly set errno for NSS function lookup failure
(cherry picked from commit ad816a5e00ce891a2cea8187638fa0e00f83aaf6)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 16 |
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index 1bb6d4c005..0d09261cac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2017-09-01 Florian Weimer <fweimer@redhat.com> + * sysdeps/posix/getaddrinfo.c (gaih_inet): Make reporting of NSS + function lookup failures more reliable. + +2017-09-01 Florian Weimer <fweimer@redhat.com> + * sysdeps/posix/getaddrinfo.c (gethosts): Use h_errno directly. (getcanonname): Likewise. (gaih_inet): Likewise. diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 798464875e..65394a37d6 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -919,13 +919,17 @@ gaih_inet (const char *name, const struct gaih_service *service, } else { + /* Could not locate any of the lookup functions. + The NSS lookup code does not consistently set + errno, so we need to supply our own error + code here. The root cause could either be a + resource allocation failure, or a missing + service function in the DSO (so it should not + be listed in /etc/nsswitch.conf). Assume the + former, and return EBUSY. */ 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); + __set_h_errno (NETDB_INTERNAL); + __set_errno (EBUSY); } } |