summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2006-03-01 15:53:49 +0000
committerume <ume@FreeBSD.org>2006-03-01 15:53:49 +0000
commit5e1521cce366a7a6191c532554259f6f85a9abfa (patch)
tree030d7f9293e0bf8741ca3f529fdeda73b64d2c70 /lib
parent1b31e5fc10af56b71e0636186451840a46c3fe03 (diff)
downloadFreeBSD-src-5e1521cce366a7a6191c532554259f6f85a9abfa.zip
FreeBSD-src-5e1521cce366a7a6191c532554259f6f85a9abfa.tar.gz
Handle the errors returned by res_querydomain() in same manner.
Reported by: yar Tested by: yar, Rostislav Krasny <rosti.bsd__at__gmail.com> MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/getaddrinfo.c20
-rw-r--r--lib/libc/net/res_query.c20
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index f38a2a7..6e98fcb 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -2440,6 +2440,17 @@ res_searchN(name, target)
ret = res_querydomainN(name, NULL, target);
if (ret > 0 || trailing_dot)
return (ret);
+ if (errno == ECONNREFUSED) {
+ h_errno = TRY_AGAIN;
+ return (-1);
+ }
+ switch (h_errno) {
+ case NO_DATA:
+ case HOST_NOT_FOUND:
+ break;
+ default:
+ return (-1);
+ }
saved_herrno = h_errno;
tried_as_is++;
}
@@ -2515,6 +2526,14 @@ res_searchN(name, target)
}
}
+ switch (h_errno) {
+ case NO_DATA:
+ case HOST_NOT_FOUND:
+ break;
+ default:
+ goto giveup;
+ }
+
/*
* If the query has not already been tried as is then try it
* unless RES_NOTLDQUERY is set and there were no dots.
@@ -2534,6 +2553,7 @@ res_searchN(name, target)
* else send back meaningless h_errno, that being the one from
* the last DNSRCH we did.
*/
+giveup:
if (saved_herrno != -1)
h_errno = saved_herrno;
else if (got_nodata)
diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c
index 483ff8d..0cfed03 100644
--- a/lib/libc/net/res_query.c
+++ b/lib/libc/net/res_query.c
@@ -229,6 +229,17 @@ res_search(name, class, type, answer, anslen)
ret = res_querydomain(name, NULL, class, type, answer, anslen);
if (ret > 0 || trailing_dot)
return (ret);
+ if (errno == ECONNREFUSED) {
+ h_errno = TRY_AGAIN;
+ return (-1);
+ }
+ switch (h_errno) {
+ case NO_DATA:
+ case HOST_NOT_FOUND:
+ break;
+ default:
+ return (-1);
+ }
saved_herrno = h_errno;
tried_as_is++;
}
@@ -318,6 +329,14 @@ res_search(name, class, type, answer, anslen)
}
}
+ switch (h_errno) {
+ case NO_DATA:
+ case HOST_NOT_FOUND:
+ break;
+ default:
+ goto giveup;
+ }
+
/*
* If the query has not already been tried as is then try it
* unless RES_NOTLDQUERY is set and there were no dots.
@@ -336,6 +355,7 @@ res_search(name, class, type, answer, anslen)
* else send back meaningless h_errno, that being the one from
* the last DNSRCH we did.
*/
+giveup:
if (saved_herrno != -1)
h_errno = saved_herrno;
else if (got_nodata)
OpenPOWER on IntegriCloud