From 3291587f23b940c986f41cf37b2e531f618ec2bd Mon Sep 17 00:00:00 2001 From: Michael Sawyer Date: Thu, 14 Sep 2000 20:11:48 +0000 Subject: [PATCH] 258. [bug] Nslookup didn't properly check class and type values. 257. [bug] Dig/Host/Nslookup didn't properly handle connect timeout in some very specific situations, and gave an unnecessary warning. --- CHANGES | 6 ++++++ bin/dig/dighost.c | 18 +++++++++++++++++- bin/dig/nslookup.c | 32 +++++++++++++++++++------------- 3 files changed, 42 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index 47666f8b5b..dcfe56f484 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ + 258. [bug] Nslookup didn't properly check class and type values. + + 257. [bug] Dig/Host/Nslookup didn't properly handle connect + timeout in some very specific situations, and gave + an unnecessary warning. + 456. [bug] Stub zones were not resetting the refresh and expire counters, loadtime or clearing the DNS_ZONE_REFRESH (refresh in progress) flag upon successful update. diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index f9777e1f75..0d1578b34b 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.126 2000/09/13 08:02:11 marka Exp $ */ +/* $Id: dighost.c,v 1.127 2000/09/14 20:11:47 mws Exp $ */ /* * Notice to programmers: Do not use this code as an example of how to @@ -669,6 +669,8 @@ setup_libs(void) { result = isc_mutex_init(&lookup_lock); check_result(result, "isc_mutex_init"); + + dns_result_register(); } /* @@ -1679,6 +1681,20 @@ connect_done(isc_task_t *task, isc_event_t *event) { query->waiting_connect = ISC_FALSE; + if (sevent->result == ISC_R_CANCELED) { + debug("in cancel handler"); + isc_socket_detach(&query->sock); + sockcount--; + INSIST(sockcount >= 0); + debug("sockcount=%d", sockcount); + query->waiting_connect = ISC_FALSE; + isc_event_free(&event); + l = query->lookup; + clear_query(query); + check_next_lookup(l); + UNLOCK_LOOKUP; + return; + } if (sevent->result != ISC_R_SUCCESS) { debug("unsuccessful connection: %s", isc_result_totext(sevent->result)); diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index 2f9feebadb..6a0088d383 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nslookup.c,v 1.42 2000/09/13 00:27:25 mws Exp $ */ +/* $Id: nslookup.c,v 1.43 2000/09/14 20:11:48 mws Exp $ */ #include @@ -483,6 +483,16 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { isc_result_t result; debug("printmessage()"); + debug("continuing on with rcode != 0"); + result = isc_buffer_allocate(mctx, &b, MXNAME); + check_result(result, "isc_buffer_allocate"); + printf("Server:\t\t%s\n", query->servname); + result = isc_sockaddr_totext(&query->sockaddr, b); + check_result(result, "isc_sockaddr_totext"); + printf("Address:\t%.*s\n", (int)isc_buffer_usedlength(b), + (char*)isc_buffer_base(b)); + isc_buffer_free(&b); + puts(""); if (msg->rcode != 0) { result = isc_buffer_allocate(mctx, &b, MXNAME); @@ -498,16 +508,6 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { debug("returning with rcode == 0"); return (ISC_R_SUCCESS); } - debug("continuing on with rcode != 0"); - result = isc_buffer_allocate(mctx, &b, MXNAME); - check_result(result, "isc_buffer_allocate"); - printf("Server:\t\t%s\n", query->servname); - result = isc_sockaddr_totext(&query->sockaddr, b); - check_result(result, "isc_sockaddr_totext"); - printf("Address:\t%.*s\n", (int)isc_buffer_usedlength(b), - (char*)isc_buffer_base(b)); - isc_buffer_free(&b); - puts(""); if (!short_form){ puts("------------"); /* detailheader(query, msg);*/ @@ -672,11 +672,17 @@ addlookup(char *opt) { tr.base = deftype; tr.length = strlen(deftype); result = dns_rdatatype_fromtext(&rdtype, &tr); - INSIST(result == ISC_R_SUCCESS); + if (result != ISC_R_SUCCESS) { + printf ("unknown query type: %s\n",deftype); + rdclass = dns_rdatatype_a; + } tr.base = defclass; tr.length = strlen(defclass); result = dns_rdataclass_fromtext(&rdclass, &tr); - INSIST(result == ISC_R_SUCCESS); + if (result != ISC_R_SUCCESS) { + printf ("unknown query class: %s\n",defclass); + rdclass = dns_rdataclass_in; + } lookup = make_empty_lookup(); strncpy(lookup->textname, opt, MXNAME-1); lookup->rdtype = rdtype;