Commit f1263d2a authored by Mark Andrews's avatar Mark Andrews
Browse files

2304. [bug] Check returns from all dns_rdata_tostruct() calls.

                        [RT #17460]
parent b1d21f6c
2304. [bug] Check returns from all dns_rdata_tostruct() calls.
[RT #17460]
2303. [bug] Remove unnecessary code from bin/named/lwdgnba.c.
[RT #17471]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.304 2007/12/03 00:21:48 marka Exp $ */
/* $Id: dighost.c,v 1.305 2008/01/14 23:24:24 marka Exp $ */
/*! \file
* \note
......@@ -1545,7 +1545,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
dns_rdataset_current(rdataset, &rdata);
query->lookup->nsfound++;
(void)dns_rdata_tostruct(&rdata, &ns, NULL);
result = dns_rdata_tostruct(&rdata, &ns, NULL);
check_result(result, "dns_rdata_tostruct");
dns_name_format(&ns.name, namestr, sizeof(namestr));
dns_rdata_freestruct(&ns);
......@@ -2664,7 +2665,8 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg,
goto next_rdata;
/* Now we have an SOA. Work with it. */
debug("got an SOA");
(void)dns_rdata_tostruct(&rdata, &soa, NULL);
result = dns_rdata_tostruct(&rdata, &soa, NULL);
check_result(result, "dns_rdata_tostruct");
serial = soa.serial;
dns_rdata_freestruct(&soa);
if (!query->first_soa_rcvd) {
......@@ -4009,9 +4011,8 @@ prepare_lookup(dns_name_t *name)
dns_rdataset_current(chase_nsrdataset, &rdata);
(void)dns_rdata_tostruct(&rdata, &ns, NULL);
result = dns_rdata_tostruct(&rdata, &ns, NULL);
check_result(result, "dns_rdata_tostruct");
#ifdef __FOLLOW_GLUE__
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.166 2007/08/27 03:32:26 marka Exp $ */
/* $Id: master.c,v 1.167 2008/01/14 23:24:24 marka Exp $ */
/*! \file */
......@@ -1801,7 +1801,9 @@ load_text(dns_loadctx_t *lctx) {
if (type == dns_rdatatype_rrsig && lctx->warn_sigexpired) {
dns_rdata_rrsig_t sig;
(void)dns_rdata_tostruct(&rdata[rdcount], &sig, NULL);
result = dns_rdata_tostruct(&rdata[rdcount], &sig,
NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (isc_serial_lt(sig.timeexpire, now)) {
(*callbacks->warn)(callbacks,
"%s:%lu: "
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: message.c,v 1.237 2007/08/14 00:25:08 marka Exp $ */
/* $Id: message.c,v 1.238 2008/01/14 23:24:24 marka Exp $ */
/*! \file */
......@@ -2930,19 +2930,24 @@ void
dns_message_dumpsig(dns_message_t *msg, char *txt1) {
dns_rdata_t querytsigrdata = DNS_RDATA_INIT;
dns_rdata_any_tsig_t querytsig;
isc_result_t result;
if (msg->tsig != NULL) {
dns_rdataset_first(msg->tsig);
result = dns_rdataset_first(msg->tsig);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_current(msg->tsig, &querytsigrdata);
dns_rdata_tostruct(&querytsigrdata, &querytsig, NULL);
result = dns_rdata_tostruct(&querytsigrdata, &querytsig, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
hexdump(txt1, "TSIG", querytsig.signature,
querytsig.siglen);
}
if (msg->querytsig != NULL) {
dns_rdataset_first(msg->querytsig);
result = dns_rdataset_first(msg->querytsig);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_current(msg->querytsig, &querytsigrdata);
dns_rdata_tostruct(&querytsigrdata, &querytsig, NULL);
result = dns_rdata_tostruct(&querytsigrdata, &querytsig, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
hexdump(txt1, "QUERYTSIG", querytsig.signature,
querytsig.siglen);
}
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: validator.c,v 1.155 2007/09/19 03:38:55 marka Exp $ */
/* $Id: validator.c,v 1.156 2008/01/14 23:24:24 marka Exp $ */
#include <config.h>
......@@ -1244,7 +1244,8 @@ isselfsigned(dns_validator_t *val) {
{
dns_rdata_reset(&rdata);
dns_rdataset_current(rdataset, &rdata);
(void)dns_rdata_tostruct(&rdata, &key, NULL);
result = dns_rdata_tostruct(&rdata, &key, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
keytag = compute_keytag(&rdata, &key);
for (result = dns_rdataset_first(sigrdataset);
result == ISC_R_SUCCESS;
......@@ -1252,7 +1253,8 @@ isselfsigned(dns_validator_t *val) {
{
dns_rdata_reset(&sigrdata);
dns_rdataset_current(sigrdataset, &sigrdata);
(void)dns_rdata_tostruct(&sigrdata, &sig, NULL);
result = dns_rdata_tostruct(&sigrdata, &sig, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (sig.algorithm == key.algorithm &&
sig.keyid == keytag)
......@@ -1512,7 +1514,8 @@ dlv_validatezonekey(dns_validator_t *val) {
result = dns_rdataset_next(&val->dlv)) {
dns_rdata_reset(&dlvrdata);
dns_rdataset_current(&val->dlv, &dlvrdata);
dns_rdata_tostruct(&dlvrdata, &dlv, NULL);
result = dns_rdata_tostruct(&dlvrdata, &dlv, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (!dns_resolver_algorithm_supported(val->view->resolver,
val->event->name,
......@@ -1532,7 +1535,8 @@ dlv_validatezonekey(dns_validator_t *val) {
{
dns_rdata_reset(&dlvrdata);
dns_rdataset_current(&val->dlv, &dlvrdata);
(void)dns_rdata_tostruct(&dlvrdata, &dlv, NULL);
result = dns_rdata_tostruct(&dlvrdata, &dlv, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (!dns_resolver_digest_supported(val->view->resolver,
dlv.digest_type))
......@@ -1557,7 +1561,8 @@ dlv_validatezonekey(dns_validator_t *val) {
{
dns_rdata_reset(&keyrdata);
dns_rdataset_current(&trdataset, &keyrdata);
(void)dns_rdata_tostruct(&keyrdata, &key, NULL);
result = dns_rdata_tostruct(&keyrdata, &key, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
keytag = compute_keytag(&keyrdata, &key);
if (dlv.key_tag != keytag ||
dlv.algorithm != key.algorithm)
......@@ -1592,7 +1597,8 @@ dlv_validatezonekey(dns_validator_t *val) {
dns_rdata_reset(&sigrdata);
dns_rdataset_current(val->event->sigrdataset,
&sigrdata);
(void)dns_rdata_tostruct(&sigrdata, &sig, NULL);
result = dns_rdata_tostruct(&sigrdata, &sig, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (dlv.key_tag != sig.keyid &&
dlv.algorithm != sig.algorithm)
continue;
......@@ -1689,7 +1695,8 @@ validatezonekey(dns_validator_t *val) {
dns_rdata_reset(&sigrdata);
dns_rdataset_current(val->event->sigrdataset,
&sigrdata);
(void)dns_rdata_tostruct(&sigrdata, &sig, NULL);
result = dns_rdata_tostruct(&sigrdata, &sig, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
result = dns_keytable_findkeynode(val->keytable,
val->event->name,
sig.algorithm,
......@@ -1846,7 +1853,8 @@ validatezonekey(dns_validator_t *val) {
result = dns_rdataset_next(val->dsset)) {
dns_rdata_reset(&dsrdata);
dns_rdataset_current(val->dsset, &dsrdata);
dns_rdata_tostruct(&dsrdata, &ds, NULL);
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (!dns_resolver_algorithm_supported(val->view->resolver,
val->event->name,
......@@ -1866,7 +1874,8 @@ validatezonekey(dns_validator_t *val) {
{
dns_rdata_reset(&dsrdata);
dns_rdataset_current(val->dsset, &dsrdata);
(void)dns_rdata_tostruct(&dsrdata, &ds, NULL);
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (!dns_resolver_digest_supported(val->view->resolver,
ds.digest_type))
......@@ -1894,7 +1903,8 @@ validatezonekey(dns_validator_t *val) {
{
dns_rdata_reset(&keyrdata);
dns_rdataset_current(&trdataset, &keyrdata);
(void)dns_rdata_tostruct(&keyrdata, &key, NULL);
result = dns_rdata_tostruct(&keyrdata, &key, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
keytag = compute_keytag(&keyrdata, &key);
if (ds.key_tag != keytag ||
ds.algorithm != key.algorithm)
......@@ -1921,7 +1931,8 @@ validatezonekey(dns_validator_t *val) {
dns_rdata_reset(&sigrdata);
dns_rdataset_current(val->event->sigrdataset,
&sigrdata);
(void)dns_rdata_tostruct(&sigrdata, &sig, NULL);
result = dns_rdata_tostruct(&sigrdata, &sig, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (ds.key_tag != sig.keyid ||
ds.algorithm != sig.algorithm)
continue;
......@@ -2224,7 +2235,8 @@ check_ds(dns_validator_t *val, dns_name_t *name, dns_rdataset_t *rdataset) {
result == ISC_R_SUCCESS;
result = dns_rdataset_next(rdataset)) {
dns_rdataset_current(rdataset, &dsrdata);
(void)dns_rdata_tostruct(&dsrdata, &ds, NULL);
result = dns_rdata_tostruct(&dsrdata, &ds, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
if (dns_resolver_digest_supported(val->view->resolver,
ds.digest_type) &&
......
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