From 87bb6b6c6bb6d5ff5e5b2a719fa32c77e9898459 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 5 Aug 2004 23:32:24 +0000 Subject: Update. 2004-08-04 Jakub Jelinek * hesiod/hesiod.c (__hesiod_res_get): Use calloc instead of malloc + memset. (__hesiod_res_set): Free nsaddrs. * include/resolv.h (__res_maybe_init): Add prototype. * resolv/resolv.h (struct __res_state): Add _u._ext.initstamp field. * resolv/Versions (libc): Add __res_maybe_init@@GLIBC_PRIVATE. * resolv/res_libc.c (__res_initstamp, lock): New variables. (res_init): Increase __res_initstamp. (__res_maybe_init): New function. * resolv/res_init.c (__res_vinit): Initialize _u._ext.initstamp. * hesiod/hesiod.c (__hesiod_res_get): Use __res_maybe_init instead of RES_INIT check and {res_ninit,__res_ninit,res_init} call. * sysdeps/posix/getaddrinfo.c (gaih_inet): Likewise. * resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r, _nss_dns_gethostbyaddr_r): Likewise. * resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r, _nss_dns_getnetbyaddr_r): Likewise. * resolv/gethnamaddr.c (gethostbyname, gethostbyname2, gethostbyaddr): Likewise. * resolv/res_data.c (fp_nquery, res_mkquery, res_mkupdate, res_isourserver, res_sendsigned, res_update, res_search, res_querydomain): Likewise. * nss/getXXbyYY_r.c (INTERNAL (REENTRANT_NAME)): Likewise. * nss/digits_dots.c (__nss_hostname_digits_dots): Likewise. * nss/getnssent_r.c (__nss_setent, __nss_endent, __nss_getent_r): Likewise. * sysdeps/posix/getaddrinfo.c (gaih_inet): Set ai_family for V4-mapped IPv6 addresses and req->ai_family==AF_INET. Reported by A. Guru . * po/pl.po: Likewise. characters than necessary. --- sysdeps/posix/getaddrinfo.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index e3986d9..a2972b1 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -604,8 +604,12 @@ gaih_inet (const char *name, const struct gaih_service *service, { if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) at->family = AF_INET6; - else if (IN6_IS_ADDR_V4MAPPED (at->addr)) - *(uint32_t *) at->addr = ((uint32_t *) at->addr)[3]; + else if (req->ai_family == AF_INET + && IN6_IS_ADDR_V4MAPPED (at->addr)) + { + *(uint32_t *) at->addr = ((uint32_t *) at->addr)[3]; + at->family = AF_INET; + } else return -EAI_ADDRFAMILY; @@ -662,7 +666,7 @@ gaih_inet (const char *name, const struct gaih_service *service, no_more = __nss_database_lookup ("hosts", NULL, "dns [!UNAVAIL=return] files", &nip); - if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) == -1) + if (__res_maybe_init (&_res, 0) == -1) no_more = 1; old_res_options = _res.options; _res.options &= ~RES_USE_INET6; -- cgit v1.1