]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dns, dns: Don't use IPv4-only error codes
authorTimo Sirainen <tss@iki.fi>
Mon, 5 Aug 2013 13:58:01 +0000 (16:58 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 5 Aug 2013 13:58:01 +0000 (16:58 +0300)
src/dns/dns-client.c
src/lib-dns/dns-lookup.c
src/lib/net.h

index 825c8001606c6a4a17b9fc9015b7ca93d798d111..dd7561e369459f51eddf9fb7991a1c98b95c9a2f 100644 (file)
@@ -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,
index 519ab13dc4eaf70c9d886d829db67b0b14c5a868..ff309dcd9fb8c4465fa8ce4bf600386c1522778b 100644 (file)
@@ -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)
index 6248733576d259587b16110c5a2aa1678599fbff..a31807bce7e7f20a0d3ce47ea36b3752a9dcbfe3 100644 (file)
@@ -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)