|
Tomas Hozza |
23b142 |
From 7d891eaf911e5cab1f704615f8f1ef87c8716f46 Mon Sep 17 00:00:00 2001
|
|
Tomas Hozza |
23b142 |
From: Mark Andrews <marka@isc.org>
|
|
Tomas Hozza |
23b142 |
Date: Wed, 1 Oct 2014 10:01:54 +1000
|
|
Tomas Hozza |
23b142 |
Subject: [PATCH] 3962. [bug] 'dig +topdown +trace +sigchase'
|
|
Tomas Hozza |
23b142 |
address unhandled error conditions. [RT #34663]
|
|
Tomas Hozza |
23b142 |
|
|
Tomas Hozza |
23b142 |
---
|
|
Tomas Hozza |
23b142 |
bin/dig/dighost.c | 31 ++++++++++++++++++++++++++-----
|
|
Tomas Hozza |
23b142 |
1 file changed, 26 insertions(+), 5 deletions(-)
|
|
Tomas Hozza |
23b142 |
|
|
Tomas Hozza |
23b142 |
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
|
|
Tomas Hozza |
23b142 |
index c99dcfc..aeded9e 100644
|
|
Tomas Hozza |
23b142 |
--- a/bin/dig/dighost.c
|
|
Tomas Hozza |
23b142 |
+++ b/bin/dig/dighost.c
|
|
Tomas Hozza |
23b142 |
@@ -56,6 +56,7 @@
|
|
Tomas Hozza |
23b142 |
#include <dns/log.h>
|
|
Tomas Hozza |
23b142 |
#include <dns/message.h>
|
|
Tomas Hozza |
23b142 |
#include <dns/name.h>
|
|
Tomas Hozza |
23b142 |
+#include <dns/rcode.h>
|
|
Tomas Hozza |
23b142 |
#include <dns/rdata.h>
|
|
Tomas Hozza |
23b142 |
#include <dns/rdataclass.h>
|
|
Tomas Hozza |
23b142 |
#include <dns/rdatalist.h>
|
|
Tomas Hozza |
23b142 |
@@ -4489,6 +4490,9 @@ chase_scanname_section(dns_message_t *msg, dns_name_t *name,
|
|
Tomas Hozza |
23b142 |
dns_rdataset_t *rdataset;
|
|
Tomas Hozza |
23b142 |
dns_name_t *msg_name = NULL;
|
|
Tomas Hozza |
23b142 |
|
|
Tomas Hozza |
23b142 |
+ if (msg->counts[section] == 0)
|
|
Tomas Hozza |
23b142 |
+ return (NULL);
|
|
Tomas Hozza |
23b142 |
+
|
|
Tomas Hozza |
23b142 |
do {
|
|
Tomas Hozza |
23b142 |
dns_message_currentname(msg, section, &msg_name);
|
|
Tomas Hozza |
23b142 |
if (dns_name_compare(msg_name, name) == 0) {
|
|
Tomas Hozza |
23b142 |
@@ -5297,6 +5301,20 @@ sigchase_td(dns_message_t *msg)
|
|
Tomas Hozza |
23b142 |
isc_boolean_t have_answer = ISC_FALSE;
|
|
Tomas Hozza |
23b142 |
isc_boolean_t true = ISC_TRUE;
|
|
Tomas Hozza |
23b142 |
|
|
Tomas Hozza |
23b142 |
+ if (msg->rcode != dns_rcode_noerror &&
|
|
Tomas Hozza |
23b142 |
+ msg->rcode != dns_rcode_nxdomain) {
|
|
Tomas Hozza |
23b142 |
+ char buf[20];
|
|
Tomas Hozza |
23b142 |
+ isc_buffer_t b;
|
|
Tomas Hozza |
23b142 |
+
|
|
Tomas Hozza |
23b142 |
+ isc_buffer_init(&b, buf, sizeof(buf));
|
|
Tomas Hozza |
23b142 |
+ result = dns_rcode_totext(msg->rcode, &b);
|
|
Tomas Hozza |
23b142 |
+ check_result(result, "dns_rcode_totext failed");
|
|
Tomas Hozza |
23b142 |
+ printf("error response code %.*s\n",
|
|
Tomas Hozza |
23b142 |
+ (int)isc_buffer_usedlength(&b), buf);
|
|
Tomas Hozza |
23b142 |
+ error_message = msg;
|
|
Tomas Hozza |
23b142 |
+ return;
|
|
Tomas Hozza |
23b142 |
+ }
|
|
Tomas Hozza |
23b142 |
+
|
|
Tomas Hozza |
23b142 |
if ((result = dns_message_firstname(msg, DNS_SECTION_ANSWER))
|
|
Tomas Hozza |
23b142 |
== ISC_R_SUCCESS) {
|
|
Tomas Hozza |
23b142 |
dns_message_currentname(msg, DNS_SECTION_ANSWER, &name);
|
|
Tomas Hozza |
23b142 |
@@ -5309,10 +5327,13 @@ sigchase_td(dns_message_t *msg)
|
|
Tomas Hozza |
23b142 |
if (!current_lookup->trace_root_sigchase) {
|
|
Tomas Hozza |
23b142 |
result = dns_message_firstname(msg,
|
|
Tomas Hozza |
23b142 |
DNS_SECTION_AUTHORITY);
|
|
Tomas Hozza |
23b142 |
- if (result == ISC_R_SUCCESS)
|
|
Tomas Hozza |
23b142 |
- dns_message_currentname(msg,
|
|
Tomas Hozza |
23b142 |
- DNS_SECTION_AUTHORITY,
|
|
Tomas Hozza |
23b142 |
- &name);
|
|
Tomas Hozza |
23b142 |
+ if (result != ISC_R_SUCCESS) {
|
|
Tomas Hozza |
23b142 |
+ printf("no answer or authority section\n");
|
|
Tomas Hozza |
23b142 |
+ error_message = msg;
|
|
Tomas Hozza |
23b142 |
+ return;
|
|
Tomas Hozza |
23b142 |
+ }
|
|
Tomas Hozza |
23b142 |
+ dns_message_currentname(msg, DNS_SECTION_AUTHORITY,
|
|
Tomas Hozza |
23b142 |
+ &name);
|
|
Tomas Hozza |
23b142 |
chase_nsrdataset
|
|
Tomas Hozza |
23b142 |
= chase_scanname_section(msg, name,
|
|
Tomas Hozza |
23b142 |
dns_rdatatype_ns,
|
|
Tomas Hozza |
23b142 |
@@ -5322,7 +5343,7 @@ sigchase_td(dns_message_t *msg)
|
|
Tomas Hozza |
23b142 |
if (chase_nsrdataset != NULL) {
|
|
Tomas Hozza |
23b142 |
have_delegation_ns = ISC_TRUE;
|
|
Tomas Hozza |
23b142 |
printf("no response but there is a delegation"
|
|
Tomas Hozza |
23b142 |
- " in authority section:");
|
|
Tomas Hozza |
23b142 |
+ " in authority section: ");
|
|
Tomas Hozza |
23b142 |
dns_name_print(name, stdout);
|
|
Tomas Hozza |
23b142 |
printf("\n");
|
|
Tomas Hozza |
23b142 |
} else {
|
|
Tomas Hozza |
23b142 |
--
|
|
Tomas Hozza |
23b142 |
1.8.2.3
|
|
Tomas Hozza |
23b142 |
|