Fallback to the internal resolver on EAI_FAIL.
authorLandon Fuller <landonf@bikemonkey.org>
Sun, 17 Feb 2013 03:57:40 +0000 (22:57 -0500)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 17 Feb 2013 06:06:36 +0000 (07:06 +0100)
On Linux, non-RFC 1034-complaint names (such as gc._msdsc.example.org)
will result in the resolver returning the non-POSIX EAI_NODATA. In that
case, the case statement here would fall back on the internal resolver,
allowing resolution to complete successfully.

On FreeBSD, the libc resolver uses the same validation code, but
the POSIX result of EAI_FAIL is returned instead of EAI_NODATA. Since
there was no case for this error code, no fallback to the internal
resolver would occur. This led to replication failing on FreeBSD.

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sun Feb 17 07:06:36 CET 2013 on sn-devel-104

source4/libcli/resolve/dns_ex.c

index bc64e8dd8d34e867cf5ce62d244207c0c814b964..1226ed6c1823b411d1e72e546ea94b98c59fb74d 100644 (file)
@@ -400,8 +400,10 @@ static void run_child_getaddrinfo(struct dns_ex_state *state, int fd)
 #ifdef EAI_NODATA
                case EAI_NODATA:
 #endif
+               case EAI_FAIL:
+                       /* Linux returns EAI_NODATA on non-RFC1034-compliant names. FreeBSD returns EAI_FAIL */
                case EAI_NONAME:
-                       /* getaddrinfo() doesn't handle CNAME records */
+                       /* getaddrinfo() doesn't handle CNAME or non-RFC1034 compatible records */
                        run_child_dns_lookup(state, fd);
                        return;
                default: