dovecot-2.2: lib-dns, dns: Don't use IPv4-only error codes

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 5 16:59:34 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/f69e08188622
changeset: 16646:f69e08188622
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 05 16:58:01 2013 +0300
description:
lib-dns, dns: Don't use IPv4-only error codes

diffstat:

 src/dns/dns-client.c     |  2 +-
 src/lib-dns/dns-lookup.c |  4 ++--
 src/lib/net.h            |  7 +++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r d6290bd28253 -r f69e08188622 src/dns/dns-client.c
--- a/src/dns/dns-client.c	Mon Aug 05 14:06:23 2013 +0300
+++ b/src/dns/dns-client.c	Mon Aug 05 16:58:01 2013 +0300
@@ -36,7 +36,7 @@
 		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 -r d6290bd28253 -r f69e08188622 src/lib-dns/dns-lookup.c
--- a/src/lib-dns/dns-lookup.c	Mon Aug 05 14:06:23 2013 +0300
+++ b/src/lib-dns/dns-lookup.c	Mon Aug 05 16:58:01 2013 +0300
@@ -146,7 +146,7 @@
 	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 @@
 		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 -r d6290bd28253 -r f69e08188622 src/lib/net.h
--- a/src/lib/net.h	Mon Aug 05 14:06:23 2013 +0300
+++ b/src/lib/net.h	Mon Aug 05 16:58:01 2013 +0300
@@ -44,6 +44,13 @@
 #  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)


More information about the dovecot-cvs mailing list