diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2019-06-27 05:26:38 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2019-06-27 05:26:38 +0000 |
commit | 2e5d5dc1eef9bb700c4c83754f8558d0e81326b7 (patch) | |
tree | dffcb6770c46117b5e246c4fd48cf41df3f19375 /lib/libc/asr | |
parent | d9f53b2bae5dfb54aaae7061b3798326b7f45cb3 (diff) |
If we don't receive a reply packet the res_send subquery will already have
set subq_h_errno and ar_count. Remove the ar_datalen == -1 check, so we
set ar_h_errno and don't have to (wrongly) guess that
ar_h_errno = HOST_NOT_FOUND.
This makes sure that if no nameserver responds the h_errno value is set to
TRY_AGAIN instead of HOST_NOT_FOUND.
OK eric@, deraadt@
Diffstat (limited to 'lib/libc/asr')
-rw-r--r-- | lib/libc/asr/gethostnamadr_async.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c index 1c30c08a0df..ecda0ffb5d4 100644 --- a/lib/libc/asr/gethostnamadr_async.c +++ b/lib/libc/asr/gethostnamadr_async.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gethostnamadr_async.c,v 1.44 2018/04/28 15:16:49 schwarze Exp $ */ +/* $OpenBSD: gethostnamadr_async.c,v 1.45 2019/06/27 05:26:37 martijn Exp $ */ /* * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> * @@ -289,12 +289,10 @@ gethostnamadr_async_run(struct asr_query *as, struct asr_result *ar) /* Done. */ as->as_subq = NULL; - if (ar->ar_datalen == -1) { - async_set_state(as, ASR_STATE_NEXT_DB); - break; - } - - /* If we got a packet but no anwser, use the next DB. */ + /* + * We either got no packet or a packet without an answer. + * Saveguard the h_errno and use the next DB. + */ if (ar->ar_count == 0) { free(ar->ar_data); as->as.hostnamadr.subq_h_errno = ar->ar_h_errno; |