From: Timo Sirainen Date: Mon, 5 Aug 2013 13:58:01 +0000 (+0300) Subject: lib-dns, dns: Don't use IPv4-only error codes X-Git-Tag: 2.2.5~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ebbb3d4af58b5166867f756db5bfd7cdad53ce2e;p=thirdparty%2Fdovecot%2Fcore.git lib-dns, dns: Don't use IPv4-only error codes --- diff --git a/src/dns/dns-client.c b/src/dns/dns-client.c index 825c800160..dd7561e369 100644 --- a/src/dns/dns-client.c +++ b/src/dns/dns-client.c @@ -36,7 +36,7 @@ static int dns_client_input_line(struct dns_client *client, const char *line) ret = net_gethostbyname(line + 3, &ips, &ips_count); if (ret == 0 && ips_count == 0) { /* shouldn't happen, but fix it anyway.. */ - ret = NO_ADDRESS; + ret = EAI_ADDRFAMILY; } if (ret != 0) { o_stream_nsend_str(client->output, diff --git a/src/lib-dns/dns-lookup.c b/src/lib-dns/dns-lookup.c index 519ab13dc4..ff309dcd9f 100644 --- a/src/lib-dns/dns-lookup.c +++ b/src/lib-dns/dns-lookup.c @@ -146,7 +146,7 @@ dns_lookup_common(const char *cmd, bool ptr_lookup, int fd; memset(&result, 0, sizeof(result)); - result.ret = NO_RECOVERY; + result.ret = EAI_FAIL; fd = net_connect_unix(set->dns_client_socket_path); if (fd == -1) { @@ -174,7 +174,7 @@ dns_lookup_common(const char *cmd, bool ptr_lookup, lookup->to = timeout_add(set->timeout_msecs, dns_lookup_timeout, lookup); } - lookup->result.ret = NO_RECOVERY; + lookup->result.ret = EAI_FAIL; lookup->callback = callback; lookup->context = context; if (gettimeofday(&lookup->start_time, NULL) < 0) diff --git a/src/lib/net.h b/src/lib/net.h index 6248733576..a31807bce7 100644 --- a/src/lib/net.h +++ b/src/lib/net.h @@ -44,6 +44,13 @@ struct net_unix_cred { # define MAX_IP_LEN 20 #endif +#ifndef HAVE_IPV6 +# undef EAI_ADDRFAMILY +# define EAI_ADDRFAMILY NO_ADDRESS +# undef EAI_FAIL +# define EAI_FAIL NO_RECOVERY +#endif + #define IPADDR_IS_V4(ip) ((ip)->family == AF_INET) #define IPADDR_IS_V6(ip) ((ip)->family == AF_INET6) #define IPADDR_BITS(ip) (IPADDR_IS_V4(ip) ? 32 : 128)