From dcbc3ff531fc1b31fdb123b5b588d00e5a969270 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Thu, 22 Jul 2010 18:48:05 +0000 Subject: [PATCH] Proper both address family lookup in /etc/hosts for c-ares >= 1.7.0. --- org.glite.security.gss/src/glite_gss.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.glite.security.gss/src/glite_gss.c b/org.glite.security.gss/src/glite_gss.c index ead8b74..290f29f 100644 --- a/org.glite.security.gss/src/glite_gss.c +++ b/org.glite.security.gss/src/glite_gss.c @@ -45,6 +45,12 @@ limitations under the License. #include "glite_gss.h" +#if ARES_VERSION >= 0x010700 +#define QUERY_AF_ALL AF_UNSPEC +#else +#define QUERY_AF_ALL AF_INET6 +#endif + #define tv_sub(a,b) {\ (a).tv_usec -= (b).tv_usec;\ (a).tv_sec -= (b).tv_sec;\ @@ -154,7 +160,7 @@ static int asyn_getservbyname(struct sockaddr_storage *addrOut, socklen_t *a_len ar.ent = (struct hostent *) calloc (sizeof(*ar.ent),1); /* query DNS server asynchronously */ - ares_gethostbyname(channel, name, AF_INET6, callback_ares_gethostbyname, + ares_gethostbyname(channel, name, QUERY_AF_ALL, callback_ares_gethostbyname, (void *) &ar); /* wait for result */ -- 1.8.2.3