summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamen.mazdrashki@postpath.com>2010-01-06 13:40:33 +0200
committerKarolin Seeger <kseeger@samba.org>2010-01-07 10:51:26 +0100
commita3ebe54761d1c0d1c99edaf6e221612c23280bf2 (patch)
treee6f23e5e861bf68b4a496de14484d78637a0d38a /source4
parent25e126d6b462672d1150d2de25355d7e5f328492 (diff)
downloadsamba-a3ebe54761d1c0d1c99edaf6e221612c23280bf2.tar.gz
samba-a3ebe54761d1c0d1c99edaf6e221612c23280bf2.tar.xz
samba-a3ebe54761d1c0d1c99edaf6e221612c23280bf2.zip
s4: Fix result check for getaddrinfo()
I think this completes commit 50feca550eed7828198b7c0fc5f0e5ddc863313d. Now result should be handled correctly both for systems that support EAI_NODATA but returns EAI_NONAME (as my Ubuntu 9.x) and systems that doesn't support EAI_NODATA at all. Signed-off-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit a2044b9a61d9c8ca66067b286ad9bc01cf0490b9) (cherry picked from commit dd35252f4dbe3dc36b35c21915bf959524dc4930)
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/resolve/dns_ex.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c
index 1b5037273a2..79ed78340c4 100644
--- a/source4/libcli/resolve/dns_ex.c
+++ b/source4/libcli/resolve/dns_ex.c
@@ -283,14 +283,19 @@ static void run_child_getaddrinfo(struct dns_ex_state *state, int fd)
hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV;
ret = getaddrinfo(state->name.name, "0", &hints, &res_list);
+ /* try to fallback in case of error */
+ if (state->do_fallback) {
+ switch (ret) {
#ifdef EAI_NODATA
- if (ret == EAI_NODATA && state->do_fallback) {
-#else
- if (ret == EAI_NONAME && state->do_fallback) {
+ case EAI_NODATA:
#endif
- /* getaddrinfo() doesn't handle CNAME records */
- run_child_dns_lookup(state, fd);
- return;
+ case EAI_NONAME:
+ /* getaddrinfo() doesn't handle CNAME records */
+ run_child_dns_lookup(state, fd);
+ return;
+ default:
+ break;
+ }
}
if (ret != 0) {
goto done;