diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 221af39f91..d9dac0e15c 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4158,8 +4158,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, &l->querysig); check_result(result, "dns_message_getquerytsig"); } - result = dns_message_setquerytsig(msg, l->querysig); - check_result(result, "dns_message_setquerytsig"); + dns_message_setquerytsig(msg, l->querysig); result = dns_message_settsigkey(msg, tsigkey); check_result(result, "dns_message_settsigkey"); msg->tsigctx = l->tsigctx; diff --git a/bin/dnssec/dnssec-cds.c b/bin/dnssec/dnssec-cds.c index 2c5590df82..b68972fa08 100644 --- a/bin/dnssec/dnssec-cds.c +++ b/bin/dnssec/dnssec-cds.c @@ -808,12 +808,13 @@ append_new_ds_set(ds_maker_func_t *ds_from_rdata, isc_buffer_t *buf, static void make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl, dns_rdataset_t *crdset) { - isc_result_t result; - dns_rdatalist_t *dslist; unsigned int size = 16; - unsigned i, n; for (;;) { + isc_result_t result = ISC_R_SUCCESS; + dns_rdatalist_t *dslist = NULL; + size_t n; + dslist = isc_mem_get(mctx, sizeof(*dslist)); dns_rdatalist_init(dslist); dslist->rdclass = rdclass; @@ -821,13 +822,12 @@ make_new_ds_set(ds_maker_func_t *ds_from_rdata, uint32_t ttl, dslist->ttl = ttl; dns_rdataset_init(&new_ds_set); - result = dns_rdatalist_tordataset(dslist, &new_ds_set); - check_result(result, "dns_rdatalist_tordataset(dslist)"); + dns_rdatalist_tordataset(dslist, &new_ds_set); isc_buffer_allocate(mctx, &new_ds_buf, size); n = sizeof(dtype) / sizeof(dtype[0]); - for (i = 0; i < n && dtype[i] != 0; i++) { + for (size_t i = 0; i < n && dtype[i] != 0; i++) { result = append_new_ds_set(ds_from_rdata, new_ds_buf, dslist, dtype[i], crdset); if (result != ISC_R_SUCCESS) { diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 9c35cd60f5..889ca79ab5 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -2040,8 +2040,7 @@ addnsec3param(const unsigned char *salt, size_t salt_len, rdatalist.rdclass = rdata.rdclass; rdatalist.type = rdata.type; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - result = dns_rdatalist_tordataset(&rdatalist, &rdataset); - check_result(result, "dns_rdatalist_tordataset()"); + dns_rdatalist_tordataset(&rdatalist, &rdataset); result = dns_db_findnode(gdb, gorigin, true, &node); check_result(result, "dns_db_findnode(gorigin)"); @@ -2102,8 +2101,7 @@ addnsec3(dns_name_t *name, dns_dbnode_t *node, const unsigned char *salt, rdatalist.type = rdata.type; rdatalist.ttl = ttl; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - result = dns_rdatalist_tordataset(&rdatalist, &rdataset); - check_result(result, "dns_rdatalist_tordataset()"); + dns_rdatalist_tordataset(&rdatalist, &rdataset); result = dns_db_findnsec3node(gdb, dns_fixedname_name(&hashname), true, &nsec3node); check_result(result, "addnsec3: dns_db_findnode()"); @@ -2204,8 +2202,7 @@ nsec3clean(dns_name_t *name, dns_dbnode_t *node, unsigned int hashalg, dns_rdata_init(&delrdata); dns_rdata_clone(&rdata, &delrdata); ISC_LIST_APPEND(rdatalist.rdata, &delrdata, link); - result = dns_rdatalist_tordataset(&rdatalist, &delrdataset); - check_result(result, "dns_rdatalist_tordataset()"); + dns_rdatalist_tordataset(&rdatalist, &delrdataset); result = dns_db_subtractrdataset(gdb, node, gversion, &delrdataset, 0, NULL); dns_rdataset_disassociate(&delrdataset); diff --git a/bin/named/server.c b/bin/named/server.c index 7c2499ea2a..a299257e33 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -3375,7 +3375,7 @@ add_soa(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); dns_rdataset_init(&rdataset); - CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); @@ -3415,7 +3415,7 @@ add_ns(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); dns_rdataset_init(&rdataset); - CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c index 898f93af16..dd8aa99268 100644 --- a/bin/named/zoneconf.c +++ b/bin/named/zoneconf.c @@ -621,17 +621,14 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone, CHECK(dns_db_findnode(db, &apexname, false, &apexnode)); /* Add NS RRset */ - RUNTIME_CHECK(dns_rdatalist_tordataset(&rdatalist_ns, &rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist_ns, &rdataset); CHECK(dns_db_addrdataset(db, apexnode, dbversion, 0, &rdataset, 0, NULL)); dns_rdataset_disassociate(&rdataset); /* Add glue A RRset, if any */ if (!ISC_LIST_EMPTY(rdatalist_a.rdata)) { - RUNTIME_CHECK( - dns_rdatalist_tordataset(&rdatalist_a, &rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist_a, &rdataset); CHECK(dns_db_addrdataset(db, apexnode, dbversion, 0, &rdataset, 0, NULL)); dns_rdataset_disassociate(&rdataset); @@ -639,9 +636,7 @@ configure_staticstub(const cfg_obj_t *zconfig, dns_zone_t *zone, /* Add glue AAAA RRset, if any */ if (!ISC_LIST_EMPTY(rdatalist_aaaa.rdata)) { - RUNTIME_CHECK( - dns_rdatalist_tordataset(&rdatalist_aaaa, &rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist_aaaa, &rdataset); CHECK(dns_db_addrdataset(db, apexnode, dbversion, 0, &rdataset, 0, NULL)); dns_rdataset_disassociate(&rdataset); diff --git a/bin/tests/system/dyndb/driver/db.c b/bin/tests/system/dyndb/driver/db.c index 05485bd631..7c3b57abb5 100644 --- a/bin/tests/system/dyndb/driver/db.c +++ b/bin/tests/system/dyndb/driver/db.c @@ -614,7 +614,7 @@ add_soa(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, rdatalist.rdclass = rdata.rdclass; rdatalist.ttl = 86400; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: @@ -652,7 +652,7 @@ add_ns(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, rdatalist.rdclass = rdata.rdclass; rdatalist.ttl = 86400; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: @@ -688,7 +688,7 @@ add_a(dns_db_t *db, dns_dbversion_t *version, const dns_name_t *name, rdatalist.rdclass = rdata.rdclass; rdatalist.ttl = 86400; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); CHECK(dns_db_findnode(db, name, true, &node)); CHECK(dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL)); cleanup: diff --git a/lib/dns/diff.c b/lib/dns/diff.c index f5f7cef11c..74d4689fee 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -349,7 +349,7 @@ diff_apply(dns_diff_t *diff, dns_db_t *db, dns_dbversion_t *ver, bool warn) { */ dns_rdataset_init(&rds); dns_rdataset_init(&ardataset); - CHECK(dns_rdatalist_tordataset(&rdl, &rds)); + dns_rdatalist_tordataset(&rdl, &rds); rds.trust = dns_trust_ultimate; /* @@ -509,7 +509,7 @@ dns_diff_load(dns_diff_t *diff, dns_addrdatasetfunc_t addfunc, * Convert the rdatalist into a rdataset. */ dns_rdataset_init(&rds); - CHECK(dns_rdatalist_tordataset(&rdl, &rds)); + dns_rdatalist_tordataset(&rdl, &rds); rds.trust = dns_trust_ultimate; INSIST(op == DNS_DIFFOP_ADD); @@ -574,7 +574,7 @@ dns_diff_sort(dns_diff_t *diff, dns_diff_compare_func *compare) { * an rdatalist structure for it to refer to. */ -static isc_result_t +static void diff_tuple_tordataset(dns_difftuple_t *t, dns_rdata_t *rdata, dns_rdatalist_t *rdl, dns_rdataset_t *rds) { REQUIRE(DNS_DIFFTUPLE_VALID(t)); @@ -589,7 +589,7 @@ diff_tuple_tordataset(dns_difftuple_t *t, dns_rdata_t *rdata, ISC_LINK_INIT(rdata, link); dns_rdata_clone(&t->rdata, rdata); ISC_LIST_APPEND(rdl->rdata, rdata, link); - return (dns_rdatalist_tordataset(rdl, rds)); + dns_rdatalist_tordataset(rdl, rds); } isc_result_t @@ -613,14 +613,7 @@ dns_diff_print(dns_diff_t *diff, FILE *file) { dns_rdataset_t rds; dns_rdata_t rd = DNS_RDATA_INIT; - result = diff_tuple_tordataset(t, &rd, &rdl, &rds); - if (result != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "diff_tuple_tordataset failed: %s", - isc_result_totext(result)); - result = ISC_R_UNEXPECTED; - goto cleanup; - } + diff_tuple_tordataset(t, &rd, &rdl, &rds); again: isc_buffer_init(&buf, mem, size); result = dns_rdataset_totext(&rds, &t->name, false, false, diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index 769f493bfa..aac978d736 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -1043,8 +1043,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) { ISC_LIST_APPEND(datalist->rdata, rdata, link); dataset = NULL; dns_message_gettemprdataset(msg, &dataset); - RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(datalist, dataset); msg->sig0 = dataset; return (ISC_R_SUCCESS); diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index 1dffab54e9..0e1a43e1fe 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -1194,7 +1194,7 @@ dns_message_gettsigkey(dns_message_t *msg); *\li 'msg' is a valid message */ -isc_result_t +void dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig); /*%< * Indicates that 'querytsig' is the TSIG from the signed query for which @@ -1207,11 +1207,6 @@ dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig); * or NULL * *\li 'msg' is a valid message - * - * Returns: - * - *\li #ISC_R_SUCCESS - *\li #ISC_R_NOMEMORY */ isc_result_t diff --git a/lib/dns/include/dns/rdatalist.h b/lib/dns/include/dns/rdatalist.h index 3608cfe45a..68709b1933 100644 --- a/lib/dns/include/dns/rdatalist.h +++ b/lib/dns/include/dns/rdatalist.h @@ -71,7 +71,7 @@ dns_rdatalist_init(dns_rdatalist_t *rdatalist); * values. */ -isc_result_t +void dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist, dns_rdataset_t *rdataset); /*%< * Make 'rdataset' refer to the rdata in 'rdatalist'. @@ -91,12 +91,9 @@ dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist, dns_rdataset_t *rdataset); * on success, * *\li 'rdataset' is associated with the rdata in rdatalist. - * - * Returns: - *\li #ISC_R_SUCCESS */ -isc_result_t +void dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, dns_rdatalist_t **rdatalist); /*%< @@ -112,9 +109,6 @@ dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, * on success, * *\li 'rdatalist' is pointed to the rdatalist in rdataset. - * - * Returns: - *\li #ISC_R_SUCCESS */ ISC_LANG_ENDDECLS diff --git a/lib/dns/master.c b/lib/dns/master.c index f733f4cfca..da2c1ee735 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -3068,8 +3068,7 @@ commit(dns_rdatacallbacks_t *callbacks, dns_loadctx_t *lctx, } do { dns_rdataset_init(&dataset); - RUNTIME_CHECK(dns_rdatalist_tordataset(this, &dataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(this, &dataset); dataset.trust = dns_trust_ultimate; /* * If this is a secure dynamic zone set the re-signing time. diff --git a/lib/dns/message.c b/lib/dns/message.c index df8615dc7c..3cbe3fa9b0 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -1078,10 +1078,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx, rdatalist->rdclass = rdclass; dns_rdataset_init(rdataset); - result = dns_rdatalist_tordataset(rdatalist, rdataset); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } + dns_rdatalist_tordataset(rdatalist, rdataset); rdataset->attributes |= DNS_RDATASETATTR_QUESTION; @@ -1516,9 +1513,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx, rdatalist->ttl = ttl; dns_rdataset_init(rdataset); - RUNTIME_CHECK( - dns_rdatalist_tordataset(rdatalist, rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(rdatalist, rdataset); dns_rdataset_setownercase(rdataset, name); if (!isedns && !istsig && !issigzero) { @@ -2835,20 +2830,19 @@ dns_message_gettsigkey(dns_message_t *msg) { return (msg->tsigkey); } -isc_result_t +void dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig) { dns_rdata_t *rdata = NULL; dns_rdatalist_t *list = NULL; dns_rdataset_t *set = NULL; isc_buffer_t *buf = NULL; isc_region_t r; - isc_result_t result; REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(msg->querytsig == NULL); if (querytsig == NULL) { - return (ISC_R_SUCCESS); + return; } dns_message_gettemprdata(msg, &rdata); @@ -2864,26 +2858,9 @@ dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig) { dns_rdata_fromregion(rdata, dns_rdataclass_any, dns_rdatatype_tsig, &r); dns_message_takebuffer(msg, &buf); ISC_LIST_APPEND(list->rdata, rdata, link); - result = dns_rdatalist_tordataset(list, set); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } + dns_rdatalist_tordataset(list, set); msg->querytsig = set; - - return (result); - -cleanup: - if (rdata != NULL) { - dns_message_puttemprdata(msg, &rdata); - } - if (list != NULL) { - dns_message_puttemprdatalist(msg, &list); - } - if (set != NULL) { - dns_message_puttemprdataset(msg, &set); - } - return (ISC_R_NOMEMORY); } isc_result_t @@ -4634,8 +4611,7 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp, rdata->flags = 0; ISC_LIST_APPEND(rdatalist->rdata, rdata, link); - result = dns_rdatalist_tordataset(rdatalist, rdataset); - RUNTIME_CHECK(result == ISC_R_SUCCESS); + dns_rdatalist_tordataset(rdatalist, rdataset); *rdatasetp = rdataset; return (ISC_R_SUCCESS); diff --git a/lib/dns/ncache.c b/lib/dns/ncache.c index 466af525f4..f7a9d00450 100644 --- a/lib/dns/ncache.c +++ b/lib/dns/ncache.c @@ -266,8 +266,7 @@ addoptout(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node, ncrdatalist.ttl = ttl; dns_rdataset_init(&ncrdataset); - RUNTIME_CHECK(dns_rdatalist_tordataset(&ncrdatalist, &ncrdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(&ncrdatalist, &ncrdataset); if (!secure && trust > dns_trust_answer) { trust = dns_trust_answer; } diff --git a/lib/dns/nsec.c b/lib/dns/nsec.c index 390127fc98..afbe9c80f9 100644 --- a/lib/dns/nsec.c +++ b/lib/dns/nsec.c @@ -195,7 +195,7 @@ dns_nsec_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node, rdatalist.type = dns_rdatatype_nsec; rdatalist.ttl = ttl; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - RETERR(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); result = dns_db_addrdataset(db, node, version, 0, &rdataset, 0, NULL); if (result == DNS_R_UNCHANGED) { result = ISC_R_SUCCESS; diff --git a/lib/dns/rdatalist.c b/lib/dns/rdatalist.c index 35fe675f2a..b739a72210 100644 --- a/lib/dns/rdatalist.c +++ b/lib/dns/rdatalist.c @@ -66,7 +66,7 @@ dns_rdatalist_init(dns_rdatalist_t *rdatalist) { rdatalist->upper[0] &= ~0x01; } -isc_result_t +void dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist, dns_rdataset_t *rdataset) { /* * Make 'rdataset' refer to the rdata in 'rdatalist'. @@ -90,17 +90,13 @@ dns_rdatalist_tordataset(dns_rdatalist_t *rdatalist, dns_rdataset_t *rdataset) { rdataset->private3 = NULL; rdataset->privateuint4 = 0; rdataset->private5 = NULL; - - return (ISC_R_SUCCESS); } -isc_result_t +void dns_rdatalist_fromrdataset(dns_rdataset_t *rdataset, dns_rdatalist_t **rdatalist) { REQUIRE(rdatalist != NULL && rdataset != NULL); *rdatalist = rdataset->private1; - - return (ISC_R_SUCCESS); } void diff --git a/lib/dns/request.c b/lib/dns/request.c index 729ae6417e..393fc330cf 100644 --- a/lib/dns/request.c +++ b/lib/dns/request.c @@ -879,10 +879,7 @@ dns_request_getresponse(dns_request_t *request, dns_message_t *message, req_log(ISC_LOG_DEBUG(3), "dns_request_getresponse: request %p", request); - result = dns_message_setquerytsig(message, request->tsig); - if (result != ISC_R_SUCCESS) { - return (result); - } + dns_message_setquerytsig(message, request->tsig); result = dns_message_settsigkey(message, request->tsigkey); if (result != ISC_R_SUCCESS) { return (result); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index f153e54d4d..3155da1a54 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -7608,12 +7608,7 @@ resquery_response(isc_result_t eresult, isc_region_t *region, void *arg) { } if (query->tsig != NULL) { - result = dns_message_setquerytsig(query->rmessage, query->tsig); - if (result != ISC_R_SUCCESS) { - FCTXTRACE3("unable to set query tsig", result); - rctx_done(&rctx, result); - return; - } + dns_message_setquerytsig(query->rmessage, query->tsig); } if (query->tsigkey != NULL) { diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index 2409092029..6c647de98a 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -1430,9 +1430,7 @@ list_tordataset(dns_rdatalist_t *rdatalist, dns_db_t *db, dns_dbnode_t *node, * - private5 is the node. */ - /* This should never fail. */ - RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(rdatalist, rdataset); rdataset->methods = &sdb_rdataset_methods; dns_db_attachnode(db, node, &rdataset->private5); diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index a90eb7c6ff..c99f63cb5f 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -1434,9 +1434,7 @@ list_tordataset(dns_rdatalist_t *rdatalist, dns_db_t *db, dns_dbnode_t *node, * - private5 is the node. */ - /* This should never fail. */ - RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(rdatalist, rdataset); rdataset->methods = &rdataset_methods; dns_db_attachnode(db, node, &rdataset->private5); diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 69484be564..366862346d 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -156,10 +156,9 @@ dns_tkeyctx_destroy(dns_tkeyctx_t **tctxp) { isc_mem_putanddetach(&mctx, tctx, sizeof(dns_tkeyctx_t)); } -static isc_result_t +static void add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata, uint32_t ttl, dns_namelist_t *namelist) { - isc_result_t result; isc_region_t r, newr; dns_rdata_t *newrdata = NULL; dns_name_t *newname = NULL; @@ -186,34 +185,12 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata, ISC_LIST_APPEND(newlist->rdata, newrdata, link); dns_message_gettemprdataset(msg, &newset); - RETERR(dns_rdatalist_tordataset(newlist, newset)); + dns_rdatalist_tordataset(newlist, newset); ISC_LIST_INIT(newname->list); ISC_LIST_APPEND(newname->list, newset, link); ISC_LIST_APPEND(*namelist, newname, link); - - return (ISC_R_SUCCESS); - -failure: - if (newrdata != NULL) { - if (ISC_LINK_LINKED(newrdata, link)) { - INSIST(newlist != NULL); - ISC_LIST_UNLINK(newlist->rdata, newrdata, link); - } - dns_message_puttemprdata(msg, &newrdata); - } - if (newname != NULL) { - dns_message_puttempname(msg, &newname); - } - if (newset != NULL) { - dns_rdataset_disassociate(newset); - dns_message_puttemprdataset(msg, &newset); - } - if (newlist != NULL) { - dns_message_puttemprdatalist(msg, &newlist); - } - return (result); } static void @@ -430,7 +407,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, } } - RETERR(add_rdata_to_list(msg, keyname, &keyrdata, ttl, namelist)); + add_rdata_to_list(msg, keyname, &keyrdata, ttl, namelist); isc_buffer_init(&ourkeybuf, keydata, sizeof(keydata)); RETERR(dst_key_todns(tctx->dhkey, &ourkeybuf)); @@ -444,7 +421,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name, /* * XXXBEW The TTL should be obtained from the database, if it exists. */ - RETERR(add_rdata_to_list(msg, &ourname, &ourkeyrdata, 0, namelist)); + add_rdata_to_list(msg, &ourname, &ourkeyrdata, 0, namelist); RETERR(dst_key_secretsize(tctx->dhkey, &sharedsize)); isc_buffer_allocate(msg->mctx, &shared, sharedsize); @@ -923,7 +900,7 @@ failure_with_tkey: goto failure; } - RETERR(add_rdata_to_list(msg, keyname, &rdata, 0, &namelist)); + add_rdata_to_list(msg, keyname, &rdata, 0, &namelist); RETERR(dns_message_reply(msg, true)); @@ -984,7 +961,7 @@ buildquery(dns_message_t *msg, const dns_name_t *name, dns_rdata_tkey_t *tkey, ISC_LIST_APPEND(tkeylist->rdata, rdata, link); dns_message_gettemprdataset(msg, &tkeyset); - RETERR(dns_rdatalist_tordataset(tkeylist, tkeyset)); + dns_rdatalist_tordataset(tkeylist, tkeyset); dns_name_copy(name, qname); dns_name_copy(name, aname); @@ -1079,7 +1056,7 @@ dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key, dns_name_clone(dst_key_name(key), &keyname); ISC_LIST_INIT(namelist); - RETERR(add_rdata_to_list(msg, &keyname, rdata, 0, &namelist)); + add_rdata_to_list(msg, &keyname, rdata, 0, &namelist); item = ISC_LIST_HEAD(namelist); while (item != NULL) { dns_name_t *next = ISC_LIST_NEXT(item, link); diff --git a/lib/dns/tsig.c b/lib/dns/tsig.c index c7536734b9..d1516ee243 100644 --- a/lib/dns/tsig.c +++ b/lib/dns/tsig.c @@ -1020,8 +1020,7 @@ dns_tsig_sign(dns_message_t *msg) { datalist->rdclass = dns_rdataclass_any; datalist->type = dns_rdatatype_tsig; ISC_LIST_APPEND(datalist->rdata, rdata, link); - RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(datalist, dataset); msg->tsig = dataset; msg->tsigname = owner; diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index aae27c2fc3..ab6c2be3ed 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -1277,9 +1277,8 @@ failure: * Convert a tuple into a dns_name_t suitable for inserting * into the given dns_message_t. */ -static isc_result_t +static void tuple2msgname(dns_difftuple_t *tuple, dns_message_t *msg, dns_name_t **target) { - isc_result_t result; dns_rdata_t *rdata = NULL; dns_rdatalist_t *rdl = NULL; dns_rdataset_t *rds = NULL; @@ -1299,30 +1298,13 @@ tuple2msgname(dns_difftuple_t *tuple, dns_message_t *msg, dns_name_t **target) { ISC_LIST_APPEND(rdl->rdata, rdata, link); dns_message_gettemprdataset(msg, &rds); - CHECK(dns_rdatalist_tordataset(rdl, rds)); + dns_rdatalist_tordataset(rdl, rds); dns_message_gettempname(msg, &name); dns_name_clone(&tuple->name, name); ISC_LIST_APPEND(name->list, rds, link); *target = name; - return (ISC_R_SUCCESS); - -failure: - - if (rds != NULL) { - dns_rdataset_disassociate(rds); - dns_message_puttemprdataset(msg, &rds); - } - if (rdl != NULL) { - ISC_LIST_UNLINK(rdl->rdata, rdata, link); - dns_message_puttemprdatalist(msg, &rdl); - } - if (rdata != NULL) { - dns_message_puttemprdata(msg, &rdata); - } - - return (result); } /* @@ -1369,7 +1351,7 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) { "requesting IXFR for serial %u", xfr->ixfr.request_serial); - CHECK(tuple2msgname(soatuple, msg, &msgsoaname)); + tuple2msgname(soatuple, msg, &msgsoaname); dns_message_addname(msg, msgsoaname, DNS_SECTION_AUTHORITY); } else if (xfr->reqtype == dns_rdatatype_soa) { CHECK(dns_db_getsoaserial(xfr->db, NULL, @@ -1483,7 +1465,7 @@ xfrin_recv_done(isc_nmhandle_t *handle, isc_result_t result, dns_message_create(xfr->mctx, DNS_MESSAGE_INTENTPARSE, &msg); CHECK(dns_message_settsigkey(msg, xfr->tsigkey)); - CHECK(dns_message_setquerytsig(msg, xfr->lasttsig)); + dns_message_setquerytsig(msg, xfr->lasttsig); msg->tsigctx = xfr->tsigctx; xfr->tsigctx = NULL; diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 4d15f6a0f3..d932b1b841 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15403,10 +15403,7 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags, temprdatalist->ttl = rdataset.ttl; ISC_LIST_APPEND(temprdatalist->rdata, temprdata, link); - result = dns_rdatalist_tordataset(temprdatalist, temprdataset); - if (result != ISC_R_SUCCESS) { - goto soa_cleanup; - } + dns_rdatalist_tordataset(temprdatalist, temprdataset); ISC_LIST_APPEND(tempname->list, temprdataset, link); dns_message_addname(message, tempname, DNS_SECTION_ANSWER); @@ -16800,8 +16797,7 @@ checkandaddsoa(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, ISC_LIST_APPEND(temprdatalist.rdata, &rdata, link); dns_rdataset_init(&temprdataset); - result = dns_rdatalist_tordataset(&temprdatalist, &temprdataset); - RUNTIME_CHECK(result == ISC_R_SUCCESS); + dns_rdatalist_tordataset(&temprdatalist, &temprdataset); name = dns_fixedname_initname(&fixed); result = dns_db_nodefullname(db, node, name); diff --git a/lib/ns/query.c b/lib/ns/query.c index 90e74ed0e2..c16cac61a2 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -485,7 +485,7 @@ query_cname(query_ctx_t *qctx); static isc_result_t query_dname(query_ctx_t *qctx); -static isc_result_t +static void query_addcname(query_ctx_t *qctx, dns_trust_t trust, dns_ttl_t ttl); static isc_result_t @@ -7326,11 +7326,7 @@ query_rpzcname(query_ctx_t *qctx, dns_name_t *cname) { } ns_client_keepname(client, qctx->fname, qctx->dbuf); - result = query_addcname(qctx, dns_trust_authanswer, - qctx->rpz_st->m.ttl); - if (result != ISC_R_SUCCESS) { - return (result); - } + query_addcname(qctx, dns_trust_authanswer, qctx->rpz_st->m.ttl); rpz_log_rewrite(client, false, qctx->rpz_st->m.policy, qctx->rpz_st->m.type, qctx->rpz_st->m.zone, @@ -8302,10 +8298,7 @@ query_dns64(query_ctx_t *qctx) { goto cleanup; } - result = dns_rdatalist_tordataset(dns64_rdatalist, dns64_rdataset); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } + dns_rdatalist_tordataset(dns64_rdatalist, dns64_rdataset); dns_rdataset_setownercase(dns64_rdataset, mname); client->query.attributes |= NS_QUERYATTR_NOADDITIONAL; dns64_rdataset->trust = qctx->rdataset->trust; @@ -8438,10 +8431,7 @@ query_filter64(query_ctx_t *qctx) { goto cleanup; } - result = dns_rdatalist_tordataset(myrdatalist, myrdataset); - if (result != ISC_R_SUCCESS) { - goto cleanup; - } + dns_rdatalist_tordataset(myrdatalist, myrdataset); dns_rdataset_setownercase(myrdataset, name); client->query.attributes |= NS_QUERYATTR_NOADDITIONAL; if (mname == name) { @@ -10463,10 +10453,7 @@ query_dname(query_ctx_t *qctx) { * on-the-fly is costly, and not really legitimate anyway * since the synthesized CNAME is NOT in the zone. */ - result = query_addcname(qctx, trdataset->trust, trdataset->ttl); - if (result != ISC_R_SUCCESS) { - return (ns_query_done(qctx)); - } + query_addcname(qctx, trdataset->trust, trdataset->ttl); /* * If the original query was not for a CNAME or ANY then follow the @@ -10496,7 +10483,7 @@ cleanup: /*% * Add CNAME to response. */ -static isc_result_t +static void query_addcname(query_ctx_t *qctx, dns_trust_t trust, dns_ttl_t ttl) { ns_client_t *client = qctx->client; dns_rdataset_t *rdataset = NULL; @@ -10526,8 +10513,7 @@ query_addcname(query_ctx_t *qctx, dns_trust_t trust, dns_ttl_t ttl) { rdata->type = dns_rdatatype_cname; ISC_LIST_APPEND(rdatalist->rdata, rdata, link); - RUNTIME_CHECK(dns_rdatalist_tordataset(rdatalist, rdataset) == - ISC_R_SUCCESS); + dns_rdatalist_tordataset(rdatalist, rdataset); rdataset->trust = trust; dns_rdataset_setownercase(rdataset, aname); @@ -10541,8 +10527,6 @@ query_addcname(query_ctx_t *qctx, dns_trust_t trust, dns_ttl_t ttl) { if (aname != NULL) { dns_message_puttempname(client->message, &aname); } - - return (ISC_R_SUCCESS); } /*% diff --git a/lib/ns/xfrout.c b/lib/ns/xfrout.c index 2e101a714f..5313a50425 100644 --- a/lib/ns/xfrout.c +++ b/lib/ns/xfrout.c @@ -146,7 +146,7 @@ log_rr(dns_name_t *name, dns_rdata_t *rdata, uint32_t ttl) { dns_rdata_init(&rd); dns_rdata_clone(rdata, &rd); ISC_LIST_APPEND(rdl.rdata, &rd, link); - RUNTIME_CHECK(dns_rdatalist_tordataset(&rdl, &rds) == ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdl, &rds); isc_buffer_init(&buf, mem, sizeof(mem)); result = dns_rdataset_totext(&rds, name, false, false, &buf); @@ -1341,7 +1341,7 @@ sendstream(xfrout_ctx_t *xfr) { msg->flags |= DNS_MESSAGEFLAG_RA; } CHECK(dns_message_settsigkey(msg, xfr->tsigkey)); - CHECK(dns_message_setquerytsig(msg, xfr->lasttsig)); + dns_message_setquerytsig(msg, xfr->lasttsig); if (xfr->lasttsig != NULL) { isc_buffer_free(&xfr->lasttsig); } @@ -1491,8 +1491,7 @@ sendstream(xfrout_ctx_t *xfr) { ISC_LIST_APPEND(msgrdl->rdata, msgrdata, link); dns_message_gettemprdataset(msg, &msgrds); - result = dns_rdatalist_tordataset(msgrdl, msgrds); - INSIST(result == ISC_R_SUCCESS); + dns_rdatalist_tordataset(msgrdl, msgrds); ISC_LIST_APPEND(msgname->list, msgrds, link); diff --git a/tests/dns/db_test.c b/tests/dns/db_test.c index 786a4a8337..6e2fa20014 100644 --- a/tests/dns/db_test.c +++ b/tests/dns/db_test.c @@ -153,8 +153,7 @@ ISC_RUN_TEST_IMPL(dns_dbfind_staleok) { } dns_rdataset_init(&rdataset); - result = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(result, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); result = dns_db_findnode(db, example, true, &node); assert_int_equal(result, ISC_R_SUCCESS); diff --git a/tests/dns/dbversion_test.c b/tests/dns/dbversion_test.c index 8124563f49..c315516fa6 100644 --- a/tests/dns/dbversion_test.c +++ b/tests/dns/dbversion_test.c @@ -277,8 +277,7 @@ ISC_RUN_TEST_IMPL(subtract) { rdatalist.rdclass = dns_rdataclass_in; - res = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(res, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); res = dns_db_findnode(db1, dns_rootname, false, &node); assert_int_equal(res, ISC_R_SUCCESS); @@ -291,8 +290,7 @@ ISC_RUN_TEST_IMPL(subtract) { } dns_rdataset_init(&rdataset); - res = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(res, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); check_assertion( dns_db_subtractrdataset(db1, node, v2, &rdataset, 0, NULL)); @@ -338,8 +336,7 @@ ISC_RUN_TEST_IMPL(addrdataset) { rdatalist.rdclass = dns_rdataclass_in; - res = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(res, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); res = dns_db_findnode(db1, dns_rootname, false, &node); assert_int_equal(res, ISC_R_SUCCESS); @@ -421,8 +418,7 @@ ISC_RUN_TEST_IMPL(resigned) { rdatalist.type = dns_rdatatype_rrsig; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); - res = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(res, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); rdataset.attributes |= DNS_RDATASETATTR_RESIGN; rdataset.resign = 7200; diff --git a/tests/dns/dns64_test.c b/tests/dns/dns64_test.c index 6ca96551e6..c55d00ef10 100644 --- a/tests/dns/dns64_test.c +++ b/tests/dns/dns64_test.c @@ -72,8 +72,7 @@ multiple_prefixes(void) { rdatalist.rdclass = rdata[0].rdclass; rdatalist.ttl = 0; dns_rdataset_init(&rdataset); - result = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(result, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); count = ARRAY_SIZE(prefix); memset(&prefix, 0, sizeof(prefix)); @@ -206,8 +205,7 @@ ISC_RUN_TEST_IMPL(dns64_findprefix) { ISC_LIST_APPEND(rdatalist.rdata, &rdata[0], link); ISC_LIST_APPEND(rdatalist.rdata, &rdata[1], link); dns_rdataset_init(&rdataset); - result = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(result, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); result = dns_dns64_findprefix(&rdataset, prefix, &count); assert_int_equal(result, tests[i].result); diff --git a/tests/dns/master_test.c b/tests/dns/master_test.c index 324edea8c5..31521bffbe 100644 --- a/tests/dns/master_test.c +++ b/tests/dns/master_test.c @@ -396,8 +396,7 @@ ISC_RUN_TEST_IMPL(totext) { rdatalist.covers = dns_rdatatype_none; dns_rdataset_init(&rdataset); - result = dns_rdatalist_tordataset(&rdatalist, &rdataset); - assert_int_equal(result, ISC_R_SUCCESS); + dns_rdatalist_tordataset(&rdatalist, &rdataset); isc_buffer_init(&target, buf, BIGBUFLEN); result = dns_master_rdatasettotext(dns_rootname, &rdataset, diff --git a/tests/dns/tsig_test.c b/tests/dns/tsig_test.c index b1fe184972..d12805ff56 100644 --- a/tests/dns/tsig_test.c +++ b/tests/dns/tsig_test.c @@ -143,7 +143,7 @@ add_tsig(dst_context_t *tsigctx, dns_tsigkey_t *key, isc_buffer_t *target) { rdatalist.type = dns_rdatatype_tsig; ISC_LIST_APPEND(rdatalist.rdata, &rdata, link); dns_rdataset_init(&rdataset); - CHECK(dns_rdatalist_tordataset(&rdatalist, &rdataset)); + dns_rdatalist_tordataset(&rdatalist, &rdataset); CHECK(dns_rdataset_towire(&rdataset, &key->name, &cctx, target, 0, &count)); @@ -228,8 +228,7 @@ render(isc_buffer_t *buf, unsigned flags, dns_tsigkey_t *key, result = dns_message_settsigkey(msg, key); assert_int_equal(result, ISC_R_SUCCESS); - result = dns_message_setquerytsig(msg, *tsigin); - assert_int_equal(result, ISC_R_SUCCESS); + dns_message_setquerytsig(msg, *tsigin); } result = dns_compress_init(&cctx, mctx); @@ -327,8 +326,7 @@ ISC_RUN_TEST_IMPL(tsig_tcp) { printmessage(msg); - result = dns_message_setquerytsig(msg, querytsig); - assert_int_equal(result, ISC_R_SUCCESS); + dns_message_setquerytsig(msg, querytsig); result = dns_tsig_verify(buf, msg, NULL, NULL); assert_int_equal(result, ISC_R_SUCCESS); @@ -385,8 +383,7 @@ ISC_RUN_TEST_IMPL(tsig_tcp) { printmessage(msg); - result = dns_message_setquerytsig(msg, tsigin); - assert_int_equal(result, ISC_R_SUCCESS); + dns_message_setquerytsig(msg, tsigin); result = dns_tsig_verify(buf, msg, NULL, NULL); assert_int_equal(result, ISC_R_SUCCESS); @@ -436,8 +433,7 @@ ISC_RUN_TEST_IMPL(tsig_tcp) { */ assert_non_null(dns_message_gettsig(msg, &tsigowner)); - result = dns_message_setquerytsig(msg, tsigin); - assert_int_equal(result, ISC_R_SUCCESS); + dns_message_setquerytsig(msg, tsigin); result = dns_tsig_verify(buf, msg, NULL, NULL); assert_int_equal(result, ISC_R_SUCCESS);