1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

Fix a few error cases in *name4_r lookup handling.

This commit is contained in:
Ulrich Drepper
2009-12-10 15:44:26 -08:00
parent 633bbc1d91
commit a682a1bf55
5 changed files with 75 additions and 56 deletions

View File

@ -1,3 +1,15 @@
2009-12-10 Ulrich Drepper <drepper@redhat.com>
[BZ #11000]
* nis/nss_nis/nis-hosts.c (_nss_nis_gethostbyname4_r): Always set
*herrnop before returning.
* nis/nss_nisplus/nisplus-hosts.c (internal_gethostbyname2_r):
Likewise.
* nss/nss_files/files-hosts.c (_nss_files_gethostbyname4_r): Handle
TRYAGAIN errors separately.
* sysdeps/posix/getaddrinfo.c (gaih_inet): Fix error handling of
*name4_r after functions.
2009-12-09 Ulrich Drepper <drepper@redhat.com>
[BZ #11046]

View File

@ -456,7 +456,10 @@ _nss_nis_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
{
char *domain;
if (yp_get_default_domain (&domain))
{
*herrnop = NO_DATA;
return NSS_STATUS_UNAVAIL;
}
/* Convert name to lowercase. */
size_t namlen = strlen (name);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2003, 2005, 2006, 2008 Free Software Foundation, Inc.
/* Copyright (C) 1997-2003, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
@ -435,6 +435,7 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
if (result == NULL)
{
*errnop = ENOMEM;
*herrnop = NETDB_INTERNAL;
return NSS_STATUS_TRYAGAIN;
}
@ -444,10 +445,13 @@ internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
if (retval == NSS_STATUS_TRYAGAIN)
{
*errnop = errno;
*herrnop = NETDB_INTERNAL;
*herrnop = TRY_AGAIN;
}
else
{
__set_errno (olderr);
*herrnop = NETDB_INTERNAL;
}
nis_freeresult (result);
return retval;
}

View File

@ -423,6 +423,11 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
if (! keep_stream)
internal_endent ();
}
else if (status == NSS_STATUS_TRYAGAIN)
{
*errnop = errno;
*herrnop = TRY_AGAIN;
}
else
{
*errnop = errno;

View File

@ -719,13 +719,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (status != NSS_STATUS_TRYAGAIN
|| rc != ERANGE || herrno != NETDB_INTERNAL)
{
if (herrno == NETDB_INTERNAL)
{
__set_h_errno (herrno);
_res.options = old_res_options;
return -EAI_SYSTEM;
}
if (herrno == TRY_AGAIN)
if (status == NSS_STATUS_TRYAGAIN
&& herrno == TRY_AGAIN)
no_data = EAI_AGAIN;
else
no_data = herrno == NO_DATA;