diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2015-05-25 19:30:26 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2015-05-25 19:30:26 +0000 |
commit | d8ab4f8831dce60f8ee537e7a0a36e129cf7cecf (patch) | |
tree | 86a5b924b1278ad86e0effbd083227046bc18c61 /lib/libc/asr | |
parent | f9069816748b41586c69739e20f7ff7dcdf1a40f (diff) |
Skip search domains iteration if RES_DNSRCH and/or RES_DEFNAMES is unset.
prodded by Brad
ok jca@
Diffstat (limited to 'lib/libc/asr')
-rw-r--r-- | lib/libc/asr/getaddrinfo_async.c | 8 | ||||
-rw-r--r-- | lib/libc/asr/res_search_async.c | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c index d6a8e84dd9a..c96b85cb94c 100644 --- a/lib/libc/asr/getaddrinfo_async.c +++ b/lib/libc/asr/getaddrinfo_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getaddrinfo_async.c,v 1.36 2015/05/05 17:08:44 jca Exp $ */ +/* $OpenBSD: getaddrinfo_async.c,v 1.37 2015/05/25 19:30:25 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -639,7 +639,11 @@ iter_domain(struct asr_query *as, const char *name, char * buf, size_t len) /* FALLTHROUGH */ case DOM_DOMAIN: - if (as->as_dom_idx < as->as_ctx->ac_domcount) { + if (as->as_dom_idx < as->as_ctx->ac_domcount && + (as->as_ctx->ac_options & RES_DNSRCH || ( + as->as_ctx->ac_options & RES_DEFNAMES && + as->as_dom_idx == 0 && + strchr(name, '.') == NULL))) { DPRINT("asr: iter_domain(\"%s\") domain \"%s\"\n", name, as->as_ctx->ac_dom[as->as_dom_idx]); as->as_dom_flags |= ASYNC_DOM_DOMAIN; diff --git a/lib/libc/asr/res_search_async.c b/lib/libc/asr/res_search_async.c index 38c32126b4d..2172bfc0d2d 100644 --- a/lib/libc/asr/res_search_async.c +++ b/lib/libc/asr/res_search_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_search_async.c,v 1.14 2014/07/23 21:26:25 eric Exp $ */ +/* $OpenBSD: res_search_async.c,v 1.15 2015/05/25 19:30:25 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -24,6 +24,7 @@ #include <asr.h> #include <err.h> #include <errno.h> +#include <resolv.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -292,7 +293,11 @@ iter_domain(struct asr_query *as, const char *name, char * buf, size_t len) /* FALLTHROUGH */ case DOM_DOMAIN: - if (as->as_dom_idx < as->as_ctx->ac_domcount) { + if (as->as_dom_idx < as->as_ctx->ac_domcount && + (as->as_ctx->ac_options & RES_DNSRCH || ( + as->as_ctx->ac_options & RES_DEFNAMES && + as->as_dom_idx == 0 && + strchr(name, '.') == NULL))) { DPRINT("asr: iter_domain(\"%s\") domain \"%s\"\n", name, as->as_ctx->ac_dom[as->as_dom_idx]); as->as_dom_flags |= ASYNC_DOM_DOMAIN; |