Commit 23e8d934 authored by Michael Sawyer's avatar Michael Sawyer
Browse files

Make host -C and dig +nss actually work.

parent aa900978
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dig.c,v 1.49 2000/06/22 17:23:48 tale Exp $ */
/* $Id: dig.c,v 1.50 2000/06/22 22:37:29 mws Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -691,9 +691,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
} else if (strncmp(rv[0], "+ns", 3) == 0) {
if (have_host) {
lookup->ns_search_only = ISC_TRUE;
lookup->trace_root = ISC_TRUE;
lookup->recurse = ISC_FALSE;
lookup->identify = ISC_TRUE;
lookup->trace = ISC_TRUE;
lookup->stats = ISC_FALSE;
if (!forcecomment)
lookup->comments = ISC_FALSE;
......@@ -1010,8 +1010,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->origin = NULL;
lookup->querysig = NULL;
lookup->use_my_server_list = ISC_FALSE;
lookup->trace = ISC_TF(trace || ns_search_only);
lookup->trace_root = trace;
lookup->trace = trace;
lookup->trace_root = ISC_TF(trace || ns_search_only);
lookup->ns_search_only = ns_search_only;
lookup->doing_xfr = ISC_FALSE;
lookup->ixfr_serial = 0;
......@@ -1078,8 +1078,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->doing_xfr = ISC_FALSE;
lookup->ixfr_serial = 0;
lookup->defname = ISC_FALSE;
lookup->trace = ISC_TF(trace || ns_search_only);
lookup->trace_root = trace;
lookup->trace_root = ISC_TF(trace || ns_search_only);
lookup->trace = trace;
lookup->ns_search_only = ns_search_only;
lookup->identify = identify;
lookup->recurse = recurse;
......@@ -1155,8 +1155,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->doing_xfr = ISC_FALSE;
lookup->ixfr_serial = 0;
lookup->defname = ISC_FALSE;
lookup->trace = ISC_TF(trace || ns_search_only);
lookup->trace_root = trace;
lookup->trace_root = ISC_TF(trace || ns_search_only);
lookup->trace = trace;
lookup->ns_search_only = ns_search_only;
lookup->identify = identify;
lookup->recurse = recurse;
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: dighost.c,v 1.55 2000/06/21 17:48:27 mws Exp $ */
/* $Id: dighost.c,v 1.56 2000/06/22 22:37:30 mws Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
......@@ -725,7 +725,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
debug ("Firstname returned %s",
isc_result_totext(result));
if ((section == DNS_SECTION_ANSWER) &&
query->lookup->trace)
(query->lookup->trace || query->lookup->ns_search_only))
followup_lookup (msg, query, DNS_SECTION_AUTHORITY);
return;
}
......@@ -776,13 +776,20 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
lookup->use_my_server_list =
ISC_TRUE;
if (section ==
DNS_SECTION_ANSWER)
lookup->trace =
DNS_SECTION_ANSWER) {
lookup->trace =
ISC_FALSE;
else
lookup->trace =
lookup->ns_search_only =
ISC_FALSE;
}
else {
lookup->trace =
query->
lookup->trace;
lookup->ns_search_only =
query->
lookup->ns_search_only;
}
lookup->trace_root = ISC_FALSE;
ISC_LIST_INIT(lookup->
my_server_list);
......@@ -813,7 +820,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query,
break;
}
if ((lookup == NULL) && (section == DNS_SECTION_ANSWER) &&
query->lookup->trace)
(query->lookup->trace || query->lookup->ns_search_only))
followup_lookup(msg, query, DNS_SECTION_AUTHORITY);
}
......@@ -1037,7 +1044,7 @@ setup_lookup(dig_lookup_t *lookup) {
* If this is a trace request, completely disallow recursion, since
* it's meaningless for traces.
*/
if (lookup->recurse && !lookup->trace) {
if (lookup->recurse && !lookup->trace && !lookup->ns_search_only) {
debug ("Recursive query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_RD;
}
......@@ -1061,6 +1068,7 @@ setup_lookup(dig_lookup_t *lookup) {
DNS_SECTION_QUESTION);
if (lookup->trace_root) {
debug("Doing trace_root");
tr.base="SOA";
tr.length=3;
} else {
......@@ -1776,12 +1784,14 @@ recv_done(isc_task_t *task, isc_event_t *event) {
if (query->lookup->xfr_q == NULL)
query->lookup->xfr_q = query;
if (query->lookup->xfr_q == query) {
if (query->lookup->trace) {
if (show_details ||
if ((query->lookup->trace)||
(query->lookup->ns_search_only)) {
debug ("In TRACE code");
if ((show_details ||
((dns_message_firstname(msg,
DNS_SECTION_ANSWER)
== ISC_R_SUCCESS) &&
!query->lookup->trace_root)) {
== ISC_R_SUCCESS))) &&
!query->lookup->trace_root ) {
printmessage(query, msg, ISC_TRUE);
}
if ((msg->rcode != 0) &&
......@@ -1835,8 +1845,16 @@ recv_done(isc_task_t *task, isc_event_t *event) {
&ab);
check_result(result, "isc_sockaddr_totext");
isc_buffer_usedregion(&ab, &r);
received(b->used, r.length, (char *)r.base,
query);
if ((( dns_message_firstname(msg,
DNS_SECTION_ANSWER)
== ISC_R_SUCCESS) &&
query->lookup->ns_search_only &&
!query->lookup->trace_root) ||
query->lookup->trace) {
received(b->used, r.length,
(char *)r.base,
query);
}
}
query->working = ISC_FALSE;
query->lookup->pending = ISC_FALSE;
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: host.c,v 1.28 2000/06/21 17:48:29 mws Exp $ */
/* $Id: host.c,v 1.29 2000/06/22 22:37:31 mws Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -670,8 +670,8 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) {
lookup->retries = tries;
lookup->udpsize = 0;
lookup->nsfound = 0;
lookup->trace = showallsoa;
lookup->trace_root = ISC_FALSE;
lookup->trace = ISC_FALSE;
lookup->trace_root = showallsoa;
lookup->tcp_mode = tcpmode;
lookup->new_search = ISC_TRUE;
lookup->aaonly = ISC_FALSE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment