2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

fixes to dns_message_sectiontotext for the question section

This commit is contained in:
Brian Wellington
2000-05-20 02:00:29 +00:00
parent 19591ace46
commit d1eee46938

View File

@@ -2390,7 +2390,8 @@ dns_message_checksig(dns_message_t *msg, dns_view_t *view) {
result = DNS_R_KEYUNAUTHORIZED; result = DNS_R_KEYUNAUTHORIZED;
freesig: freesig:
dns_rdataset_disassociate(&keyset); if (dns_rdataset_isassociated(&keyset))
dns_rdataset_disassociate(&keyset);
dns_rdata_freestruct(&sig); dns_rdata_freestruct(&sig);
return (result); return (result);
} }
@@ -2404,11 +2405,17 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section,
dns_name_t *name, empty_name; dns_name_t *name, empty_name;
dns_rdataset_t *rdataset; dns_rdataset_t *rdataset;
isc_result_t result; isc_result_t result;
isc_boolean_t no_rdata;
REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(target != NULL); REQUIRE(target != NULL);
REQUIRE(VALID_SECTION(section)); REQUIRE(VALID_SECTION(section));
if (section == DNS_SECTION_QUESTION)
no_rdata = ISC_TRUE;
else
no_rdata = ISC_FALSE;
if (comments) { if (comments) {
ADD_STRING(target, ";; "); ADD_STRING(target, ";; ");
ADD_STRING(target, sectiontext[section]); ADD_STRING(target, sectiontext[section]);
@@ -2418,7 +2425,7 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section,
dns_name_init(&empty_name, NULL); dns_name_init(&empty_name, NULL);
result = dns_message_firstname(msg, section); result = dns_message_firstname(msg, section);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return(result); return (result);
} }
do { do {
name = NULL; name = NULL;
@@ -2426,23 +2433,20 @@ dns_message_sectiontotext(dns_message_t *msg, dns_section_t section,
for (rdataset = ISC_LIST_HEAD(name->list); for (rdataset = ISC_LIST_HEAD(name->list);
rdataset != NULL; rdataset != NULL;
rdataset = ISC_LIST_NEXT(rdataset, link)) { rdataset = ISC_LIST_NEXT(rdataset, link)) {
result = dns_rdataset_first(rdataset); if (no_rdata)
if (result != ISC_R_NOMORE) { ADD_STRING(target, ";");
if (result != ISC_R_SUCCESS) result = dns_rdataset_totext(rdataset, name,
return(result); omit_final_dot,
result = dns_rdataset_totext(rdataset, name, no_rdata,
omit_final_dot, target);
ISC_FALSE, if (result != ISC_R_SUCCESS)
target); return (result);
if (result != ISC_R_SUCCESS)
return(result);
}
} }
result = dns_message_nextname(msg, section); result = dns_message_nextname(msg, section);
} while (result == ISC_R_SUCCESS); } while (result == ISC_R_SUCCESS);
if (result == ISC_R_NOMORE) if (result == ISC_R_NOMORE)
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;
return(result); return (result);
} }
isc_result_t isc_result_t
@@ -2548,5 +2552,5 @@ dns_message_totext(dns_message_t *msg, isc_boolean_t comments,
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
} }
return(ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }