add_question(dns_message_t *message, dns_name_t *name, dns_rdataclass_t rdclass,
dns_rdatatype_t rdtype) {
dns_rdataset_t *rdataset;
- isc_result_t result;
debug("add_question()");
rdataset = NULL;
- result = dns_message_gettemprdataset(message, &rdataset);
- check_result(result, "dns_message_gettemprdataset()");
+ dns_message_gettemprdataset(message, &rdataset);
dns_rdataset_makequestion(rdataset, rdclass, rdtype);
ISC_LIST_APPEND(name->list, rdataset, link);
}
isc_buffer_init(&lookup->rdatabuf, lookup->rdatastore,
sizeof(lookup->rdatastore));
- result = dns_message_gettemprdata(lookup->sendmsg, &rdata);
- check_result(result, "dns_message_gettemprdata");
+ dns_message_gettemprdata(lookup->sendmsg, &rdata);
result = dns_rdata_fromstruct(rdata, lookup->rdclass, dns_rdatatype_soa,
&soa, &lookup->rdatabuf);
check_result(result, "isc_rdata_fromstruct");
- result = dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist);
- check_result(result, "dns_message_gettemprdatalist");
+ dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist);
- result = dns_message_gettemprdataset(lookup->sendmsg, &rdataset);
- check_result(result, "dns_message_gettemprdataset");
+ dns_message_gettemprdataset(lookup->sendmsg, &rdataset);
dns_rdatalist_init(rdatalist);
rdatalist->type = dns_rdatatype_soa;
dns_rdatalist_tordataset(rdatalist, rdataset);
- result = dns_message_gettempname(lookup->sendmsg, &soaname);
- check_result(result, "dns_message_gettempname");
+ dns_message_gettempname(lookup->sendmsg, &soaname);
dns_name_clone(lookup->name, soaname);
ISC_LIST_INIT(soaname->list);
ISC_LIST_APPEND(soaname->list, rdataset, link);
debug("cloning server list");
clone_server_list(server_list, &lookup->my_server_list);
}
- result = dns_message_gettempname(lookup->sendmsg, &lookup->name);
- check_result(result, "dns_message_gettempname");
+ dns_message_gettempname(lookup->sendmsg, &lookup->name);
isc_buffer_init(&lookup->namebuf, lookup->name_space,
sizeof(lookup->name_space));
if (lookup->origin != NULL) {
debug("trying origin %s", lookup->origin->origin);
- result = dns_message_gettempname(lookup->sendmsg,
- &lookup->oname);
- check_result(result, "dns_message_gettempname");
+ dns_message_gettempname(lookup->sendmsg, &lookup->oname);
/* XXX Helper funct to conv char* to name? */
origin = lookup->origin->origin;
#ifdef HAVE_LIBIDN2
result = dns_name_fromtext(lookup->name, &b,
dns_rootname, 0,
&lookup->namebuf);
- }
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(lookup->sendmsg, &lookup->name);
- warn("'%s' is not a legal name "
- "(%s)",
- lookup->textname, isc_result_totext(result));
+ if (result != ISC_R_SUCCESS) {
+ dns_message_puttempname(lookup->sendmsg,
+ &lookup->name);
+ warn("'%s' is not a legal name (%s)",
+ lookup->textname,
+ isc_result_totext(result));
#if TARGET_OS_IPHONE
- clear_current_lookup();
- return (false);
+ clear_current_lookup();
+ return (false);
#else /* if TARGET_OS_IPHONE */
- digexit();
+ digexit();
#endif /* if TARGET_OS_IPHONE */
+ }
}
}
dns_name_format(lookup->name, store, sizeof(store));
return (STATUS_SYNTAX);
}
- result = dns_message_gettempname(msg, namep);
- check_result(result, "dns_message_gettempname");
+ dns_message_gettempname(msg, namep);
isc_buffer_init(&source, word, strlen(word));
isc_buffer_add(&source, strlen(word));
result = dns_name_fromtext(*namep, &source, dns_rootname, 0, NULL);
rdatatype = dns_rdatatype_any;
}
- result = dns_message_gettemprdata(updatemsg, &rdata);
- check_result(result, "dns_message_gettemprdata");
+ dns_message_gettemprdata(updatemsg, &rdata);
dns_rdata_init(rdata);
rdata->flags = DNS_RDATA_UPDATE;
}
- result = dns_message_gettemprdatalist(updatemsg, &rdatalist);
- check_result(result, "dns_message_gettemprdatalist");
- result = dns_message_gettemprdataset(updatemsg, &rdataset);
- check_result(result, "dns_message_gettemprdataset");
+ dns_message_gettemprdatalist(updatemsg, &rdatalist);
+ dns_message_gettemprdataset(updatemsg, &rdataset);
rdatalist->type = rdatatype;
if (ispositive) {
if (isrrset && rdata->data != NULL) {
return (retval);
}
- result = dns_message_gettemprdata(updatemsg, &rdata);
- check_result(result, "dns_message_gettemprdata");
+ dns_message_gettemprdata(updatemsg, &rdata);
dns_rdata_init(rdata);
doneparsing:
- result = dns_message_gettemprdatalist(updatemsg, &rdatalist);
- check_result(result, "dns_message_gettemprdatalist");
- result = dns_message_gettemprdataset(updatemsg, &rdataset);
- check_result(result, "dns_message_gettemprdataset");
+ dns_message_gettemprdatalist(updatemsg, &rdatalist);
+ dns_message_gettemprdataset(updatemsg, &rdataset);
rdatalist->type = rdatatype;
rdatalist->rdclass = rdataclass;
rdatalist->covers = rdatatype;
}
if (zonename != NULL) {
- result = dns_message_gettempname(updatemsg, &name);
- check_result(result, "dns_message_gettempname");
+ dns_message_gettempname(updatemsg, &name);
dns_name_clone(zonename, name);
- result = dns_message_gettemprdataset(updatemsg, &rdataset);
- check_result(result, "dns_message_gettemprdataset");
+ dns_message_gettemprdataset(updatemsg, &rdataset);
dns_rdataset_makequestion(rdataset, getzoneclass(),
dns_rdatatype_soa);
ISC_LIST_INIT(name->list);
soaquery->flags |= DNS_MESSAGEFLAG_RD;
}
- result = dns_message_gettempname(soaquery, &name);
- check_result(result, "dns_message_gettempname");
+ dns_message_gettempname(soaquery, &name);
- result = dns_message_gettemprdataset(soaquery, &rdataset);
- check_result(result, "dns_message_gettemprdataset");
+ dns_message_gettemprdataset(soaquery, &rdataset);
dns_rdataset_makequestion(rdataset, getzoneclass(), dns_rdatatype_soa);
message->rdclass = dns_rdataclass_in;
message->id = (unsigned short)(random() & 0xFFFF);
- result = dns_message_gettempname(message, &qname);
- CHECK("dns_message_gettempname", result);
+ dns_message_gettempname(message, &qname);
- result = dns_message_gettemprdataset(message, &qrdataset);
- CHECK("dns_message_gettemprdataset", result);
+ dns_message_gettemprdataset(message, &qrdataset);
dns_name_clone(dns_fixedname_name(&queryname), qname);
dns_rdataset_makequestion(qrdataset, dns_rdataclass_in,
message->rdclass = query->rdclass;
message->id = (unsigned short)(random() & 0xFFFF);
- result = dns_message_gettempname(message, &qname);
- CHECK("dns_message_gettempname", result);
+ dns_message_gettempname(message, &qname);
- result = dns_message_gettemprdataset(message, &qrdataset);
- CHECK("dns_message_gettemprdataset", result);
+ dns_message_gettemprdataset(message, &qrdataset);
dns_name_clone(dns_fixedname_name(&queryname), qname);
dns_rdataset_makequestion(qrdataset, query->rdclass, query->rdtype);
--- /dev/null
+@@
+statement S;
+expression V;
+@@
+
+- V =
+ dns_message_gettempname(...);
+- if (V != ISC_R_SUCCESS) S
+
+@@
+statement S;
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdata(...);
+- if (V != ISC_R_SUCCESS) S
+
+@@
+statement S;
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdataset(...);
+- if (V != ISC_R_SUCCESS) S
+
+@@
+statement S;
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdatalist(...);
+- if (V != ISC_R_SUCCESS) S
+
+@@
+@@
+
+- CHECK(
+ dns_message_gettempname(...)
+- )
+
+@@
+@@
+
+- CHECK(
+ dns_message_gettemprdata(...)
+- )
+
+@@
+@@
+
+- CHECK(
+ dns_message_gettemprdataset(...)
+- )
+
+@@
+@@
+
+- CHECK(
+ dns_message_gettemprdatalist(...)
+- )
+
+@@
+@@
+
+- RETERR(
+ dns_message_gettempname(...)
+- )
+
+@@
+@@
+
+- RETERR(
+ dns_message_gettemprdata(...)
+- )
+
+@@
+@@
+
+- RETERR(
+ dns_message_gettemprdataset(...)
+- )
+
+@@
+@@
+
+- RETERR(
+ dns_message_gettemprdatalist(...)
+- )
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettempname(...);
+- check_result(V, ...);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdata(...);
+- check_result(V, ...);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdataset(...);
+- check_result(V, ...);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdatalist(...);
+- check_result(V, ...);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettempname(...);
+- CHECK(..., V);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdata(...);
+- CHECK(..., V);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdataset(...);
+- CHECK(..., V);
+
+@@
+expression V;
+@@
+
+- V =
+ dns_message_gettemprdatalist(...);
+- CHECK(..., V);
dst_context_destroy(&ctx);
rdata = NULL;
- RETERR(dns_message_gettemprdata(msg, &rdata));
+ dns_message_gettemprdata(msg, &rdata);
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
dns_rdatatype_sig /* SIG(0) */, &sig,
dns_message_takebuffer(msg, &dynbuf);
datalist = NULL;
- RETERR(dns_message_gettemprdatalist(msg, &datalist));
+ dns_message_gettemprdatalist(msg, &datalist);
datalist->rdclass = dns_rdataclass_any;
datalist->type = dns_rdatatype_sig; /* SIG(0) */
ISC_LIST_APPEND(datalist->rdata, rdata, link);
dataset = NULL;
- RETERR(dns_message_gettemprdataset(msg, &dataset));
+ dns_message_gettemprdataset(msg, &dataset);
RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) ==
ISC_R_SUCCESS);
msg->sig0 = dataset;
* reset, and must NOT be used after these operations.
*/
-isc_result_t
+void
dns_message_gettempname(dns_message_t *msg, dns_name_t **item);
/*%<
* Return a name that can be used for any temporary purpose, including
*\li msg be a valid message
*
*\li item != NULL && *item == NULL
- *
- * Returns:
- *\li #ISC_R_SUCCESS -- All is well.
*/
-isc_result_t
+void
dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item);
/*%<
* Return a rdata that can be used for any temporary purpose, including
*\li msg be a valid message
*
*\li item != NULL && *item == NULL
- *
- * Returns:
- *\li #ISC_R_SUCCESS -- All is well.
*/
-isc_result_t
+void
dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item);
/*%<
* Return a rdataset that can be used for any temporary purpose, including
*\li msg be a valid message
*
*\li item != NULL && *item == NULL
- *
- * Returns:
- *\li #ISC_R_SUCCESS -- All is well.
*/
-isc_result_t
+void
dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item);
/*%<
* Return a rdatalist that can be used for any temporary purpose, including
*\li msg be a valid message
*
*\li item != NULL && *item == NULL
- *
- * Returns:
- *\li #ISC_R_SUCCESS -- All is well.
*/
void
for (count = 0; count < msg->counts[DNS_SECTION_QUESTION]; count++) {
name = NULL;
- result = dns_message_gettempname(msg, &name);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettempname(msg, &name);
name->offsets = (unsigned char *)newoffsets(msg);
free_name = true;
istsig = false;
name = NULL;
- result = dns_message_gettempname(msg, &name);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettempname(msg, &name);
name->offsets = (unsigned char *)newoffsets(msg);
free_name = true;
ISC_LIST_UNLINK(msg->sections[section], name, link);
}
-isc_result_t
+void
dns_message_gettempname(dns_message_t *msg, dns_name_t **item) {
dns_fixedname_t *fn = NULL;
fn = isc_mempool_get(msg->namepool);
*item = dns_fixedname_initname(fn);
-
- return (ISC_R_SUCCESS);
}
-isc_result_t
+void
dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item) {
REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(item != NULL && *item == NULL);
*item = newrdata(msg);
- return (ISC_R_SUCCESS);
}
-isc_result_t
+void
dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) {
REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(item != NULL && *item == NULL);
*item = isc_mempool_get(msg->rdspool);
dns_rdataset_init(*item);
- return (ISC_R_SUCCESS);
}
-isc_result_t
+void
dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) {
REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(item != NULL && *item == NULL);
*item = newrdatalist(msg);
- return (ISC_R_SUCCESS);
}
void
return (ISC_R_SUCCESS);
}
- result = dns_message_gettemprdata(msg, &rdata);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdata(msg, &rdata);
- result = dns_message_gettemprdatalist(msg, &list);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_gettemprdataset(msg, &set);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdatalist(msg, &list);
+ dns_message_gettemprdataset(msg, &set);
isc_buffer_usedregion(querytsig, &r);
isc_buffer_allocate(msg->mctx, &buf, r.length);
REQUIRE(DNS_MESSAGE_VALID(message));
REQUIRE(rdatasetp != NULL && *rdatasetp == NULL);
- result = dns_message_gettemprdatalist(message, &rdatalist);
- if (result != ISC_R_SUCCESS) {
- return (result);
- }
- result = dns_message_gettemprdata(message, &rdata);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_gettemprdataset(message, &rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdatalist(message, &rdatalist);
+ dns_message_gettemprdata(message, &rdata);
+ dns_message_gettemprdataset(message, &rdataset);
rdatalist->type = dns_rdatatype_opt;
bool restarted = false;
rbtdb_glue_t *ge;
rbtdb_glue_additionaldata_ctx_t ctx;
- isc_result_t result;
uint64_t hash;
REQUIRE(rdataset->type == dns_rdatatype_ns);
dns_rdataset_t *sigrdataset_aaaa = NULL;
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
- result = dns_message_gettempname(msg, &name);
- if (result != ISC_R_SUCCESS) {
- goto no_glue;
- }
+ dns_message_gettempname(msg, &name);
dns_name_copy(gluename, name);
if (dns_rdataset_isassociated(&ge->rdataset_a)) {
- result = dns_message_gettemprdataset(msg, &rdataset_a);
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(msg, &name);
- goto no_glue;
- }
+ dns_message_gettemprdataset(msg, &rdataset_a);
}
if (dns_rdataset_isassociated(&ge->sigrdataset_a)) {
- result = dns_message_gettemprdataset(msg,
- &sigrdataset_a);
- if (result != ISC_R_SUCCESS) {
- if (rdataset_a != NULL) {
- dns_message_puttemprdataset(
- msg, &rdataset_a);
- }
- dns_message_puttempname(msg, &name);
- goto no_glue;
- }
+ dns_message_gettemprdataset(msg, &sigrdataset_a);
}
if (dns_rdataset_isassociated(&ge->rdataset_aaaa)) {
- result = dns_message_gettemprdataset(msg,
- &rdataset_aaaa);
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(msg, &name);
- if (rdataset_a != NULL) {
- dns_message_puttemprdataset(
- msg, &rdataset_a);
- }
- if (sigrdataset_a != NULL) {
- dns_message_puttemprdataset(
- msg, &sigrdataset_a);
- }
- goto no_glue;
- }
+ dns_message_gettemprdataset(msg, &rdataset_aaaa);
}
if (dns_rdataset_isassociated(&ge->sigrdataset_aaaa)) {
- result = dns_message_gettemprdataset(msg,
- &sigrdataset_aaaa);
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(msg, &name);
- if (rdataset_a != NULL) {
- dns_message_puttemprdataset(
- msg, &rdataset_a);
- }
- if (sigrdataset_a != NULL) {
- dns_message_puttemprdataset(
- msg, &sigrdataset_a);
- }
- if (rdataset_aaaa != NULL) {
- dns_message_puttemprdataset(
- msg, &rdataset_aaaa);
- }
- goto no_glue;
- }
+ dns_message_gettemprdataset(msg, &sigrdataset_aaaa);
}
if (rdataset_a != NULL) {
return (ISC_R_SHUTTINGDOWN);
}
- result = dns_message_gettempname(fctx->qmessage, &qname);
- if (result != ISC_R_SUCCESS) {
- goto cleanup_temps;
- }
- result = dns_message_gettemprdataset(fctx->qmessage, &qrdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup_temps;
- }
+ dns_message_gettempname(fctx->qmessage, &qname);
+ dns_message_gettemprdataset(fctx->qmessage, &qrdataset);
fctx->qmessage->opcode = dns_opcode_query;
dns_rdataset_makequestion(qrdataset, res->rdclass, fctx->type);
ISC_LIST_APPEND(qname->list, qrdataset, link);
dns_message_addname(fctx->qmessage, qname, DNS_SECTION_QUESTION);
- qname = NULL;
- qrdataset = NULL;
/*
* Set RD if the client has requested that we do a recursive
*/
dns_dispatch_done(&query->dispentry);
-cleanup_temps:
- if (qname != NULL) {
- dns_message_puttempname(fctx->qmessage, &qname);
- }
- if (qrdataset != NULL) {
- dns_message_puttemprdataset(fctx->qmessage, &qrdataset);
- }
-
return (result);
}
dns_rdataset_t *newset = NULL;
isc_buffer_t *tmprdatabuf = NULL;
- RETERR(dns_message_gettemprdata(msg, &newrdata));
+ dns_message_gettemprdata(msg, &newrdata);
dns_rdata_toregion(rdata, &r);
isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length);
dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr);
dns_message_takebuffer(msg, &tmprdatabuf);
- RETERR(dns_message_gettempname(msg, &newname));
+ dns_message_gettempname(msg, &newname);
dns_name_copy(name, newname);
- RETERR(dns_message_gettemprdatalist(msg, &newlist));
+ dns_message_gettemprdatalist(msg, &newlist);
newlist->rdclass = newrdata->rdclass;
newlist->type = newrdata->type;
newlist->ttl = ttl;
ISC_LIST_APPEND(newlist->rdata, newrdata, link);
- RETERR(dns_message_gettemprdataset(msg, &newset));
+ dns_message_gettemprdataset(msg, &newset);
RETERR(dns_rdatalist_tordataset(newlist, newset));
ISC_LIST_INIT(newname->list);
REQUIRE(name != NULL);
REQUIRE(tkey != NULL);
- RETERR(dns_message_gettempname(msg, &qname));
- RETERR(dns_message_gettempname(msg, &aname));
+ dns_message_gettempname(msg, &qname);
+ dns_message_gettempname(msg, &aname);
- RETERR(dns_message_gettemprdataset(msg, &question));
+ dns_message_gettemprdataset(msg, &question);
dns_rdataset_makequestion(question, dns_rdataclass_any,
dns_rdatatype_tkey);
len = 16 + tkey->algorithm.length + tkey->keylen + tkey->otherlen;
isc_buffer_allocate(msg->mctx, &dynbuf, len);
- RETERR(dns_message_gettemprdata(msg, &rdata));
+ dns_message_gettemprdata(msg, &rdata);
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
dns_rdatatype_tkey, tkey, dynbuf));
dns_message_takebuffer(msg, &dynbuf);
- RETERR(dns_message_gettemprdatalist(msg, &tkeylist));
+ dns_message_gettemprdatalist(msg, &tkeylist);
tkeylist->rdclass = dns_rdataclass_any;
tkeylist->type = dns_rdatatype_tkey;
ISC_LIST_APPEND(tkeylist->rdata, rdata, link);
- RETERR(dns_message_gettemprdataset(msg, &tkeyset));
+ dns_message_gettemprdataset(msg, &tkeyset);
RETERR(dns_rdatalist_tordataset(tkeylist, tkeyset));
dns_name_copy(name, qname);
RETERR(buildquery(msg, name, &tkey, false));
- RETERR(dns_message_gettemprdata(msg, &rdata));
+ dns_message_gettemprdata(msg, &rdata);
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
RETERR(dst_key_todns(key, dynbuf));
isc_buffer_usedregion(dynbuf, &r);
tsig.signature = NULL;
}
- ret = dns_message_gettemprdata(msg, &rdata);
- if (ret != ISC_R_SUCCESS) {
- goto cleanup_signature;
- }
+ dns_message_gettemprdata(msg, &rdata);
isc_buffer_allocate(msg->mctx, &dynbuf, 512);
ret = dns_rdata_fromstruct(rdata, dns_rdataclass_any,
dns_rdatatype_tsig, &tsig, dynbuf);
tsig.signature = NULL;
}
- ret = dns_message_gettempname(msg, &owner);
- if (ret != ISC_R_SUCCESS) {
- goto cleanup_rdata;
- }
+ dns_message_gettempname(msg, &owner);
dns_name_copy(&key->name, owner);
- ret = dns_message_gettemprdatalist(msg, &datalist);
- if (ret != ISC_R_SUCCESS) {
- goto cleanup_owner;
- }
+ dns_message_gettemprdatalist(msg, &datalist);
- ret = dns_message_gettemprdataset(msg, &dataset);
- if (ret != ISC_R_SUCCESS) {
- goto cleanup_rdatalist;
- }
+ dns_message_gettemprdataset(msg, &dataset);
datalist->rdclass = dns_rdataclass_any;
datalist->type = dns_rdatatype_tsig;
ISC_LIST_APPEND(datalist->rdata, rdata, link);
return (ISC_R_SUCCESS);
-cleanup_rdatalist:
- dns_message_puttemprdatalist(msg, &datalist);
-cleanup_owner:
- dns_message_puttempname(msg, &owner);
- goto cleanup_rdata;
cleanup_dynbuf:
isc_buffer_free(&dynbuf);
-cleanup_rdata:
dns_message_puttemprdata(msg, &rdata);
cleanup_signature:
if (tsig.signature != NULL) {
REQUIRE(target != NULL && *target == NULL);
- CHECK(dns_message_gettemprdata(msg, &rdata));
+ dns_message_gettemprdata(msg, &rdata);
dns_rdata_init(rdata);
dns_rdata_clone(&tuple->rdata, rdata);
- CHECK(dns_message_gettemprdatalist(msg, &rdl));
+ dns_message_gettemprdatalist(msg, &rdl);
dns_rdatalist_init(rdl);
rdl->type = tuple->rdata.type;
rdl->rdclass = tuple->rdata.rdclass;
rdl->ttl = tuple->ttl;
ISC_LIST_APPEND(rdl->rdata, rdata, link);
- CHECK(dns_message_gettemprdataset(msg, &rds));
+ dns_message_gettemprdataset(msg, &rds);
CHECK(dns_rdatalist_tordataset(rdl, rds));
- CHECK(dns_message_gettempname(msg, &name));
+ dns_message_gettempname(msg, &name);
dns_name_clone(&tuple->name, name);
ISC_LIST_APPEND(name->list, rds, link);
CHECK(dns_message_settsigkey(msg, xfr->tsigkey));
/* Create a name for the question section. */
- CHECK(dns_message_gettempname(msg, &qname));
+ dns_message_gettempname(msg, &qname);
dns_name_clone(&xfr->name, qname);
/* Formulate the question and attach it to the question name. */
- CHECK(dns_message_gettemprdataset(msg, &qrdataset));
+ dns_message_gettemprdataset(msg, &qrdataset);
dns_rdataset_makequestion(qrdataset, xfr->rdclass, xfr->reqtype);
ISC_LIST_APPEND(qname->list, qrdataset, link);
qrdataset = NULL;
checkds_cancel(dns_zone_t *zone);
static void
checkds_send(dns_zone_t *zone);
-static isc_result_t
+static void
checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep);
static void
checkds_done(isc_task_t *task, isc_event_t *event);
/***
*** Private
***/
-static isc_result_t
+static void
create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, dns_name_t *name,
dns_message_t **messagep) {
dns_message_t *message = NULL;
dns_name_t *qname = NULL;
dns_rdataset_t *qrdataset = NULL;
- isc_result_t result;
dns_message_create(zone->mctx, DNS_MESSAGE_INTENTRENDER, &message);
message->opcode = dns_opcode_query;
message->rdclass = zone->rdclass;
- result = dns_message_gettempname(message, &qname);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettempname(message, &qname);
- result = dns_message_gettemprdataset(message, &qrdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdataset(message, &qrdataset);
/*
* Make question.
dns_message_addname(message, qname, DNS_SECTION_QUESTION);
*messagep = message;
- return (ISC_R_SUCCESS);
-
-cleanup:
- if (qname != NULL) {
- dns_message_puttempname(message, &qname);
- }
- if (qrdataset != NULL) {
- dns_message_puttemprdataset(message, &qrdataset);
- }
- dns_message_detach(&message);
- return (result);
}
static isc_result_t
request->ipv4 = ipv4;
dns_name_dup(name, zone->mctx, &request->name);
- result = create_query(zone, ipv4 ? dns_rdatatype_a : dns_rdatatype_aaaa,
- &request->name, &message);
- INSIST(result == ISC_R_SUCCESS);
+ create_query(zone, ipv4 ? dns_rdatatype_a : dns_rdatatype_aaaa,
+ &request->name, &message);
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) {
result = add_opt(message, args->udpsize, args->reqnsid, false);
goto cleanup;
}
- result = create_query(zone, dns_rdatatype_soa, &zone->origin, &message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ create_query(zone, dns_rdatatype_soa, &zone->origin, &message);
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) {
result = add_opt(message, udpsize, reqnsid, reqexpire);
/*
* XXX Optimisation: Create message when zone is setup and reuse.
*/
- result = create_query(zone, dns_rdatatype_ns, &zone->origin, &message);
- INSIST(result == ISC_R_SUCCESS);
+ create_query(zone, dns_rdatatype_ns, &zone->origin, &message);
INSIST(zone->primariescnt > 0);
INSIST(zone->curprimary < zone->primariescnt);
message->flags |= DNS_MESSAGEFLAG_AA;
message->rdclass = zone->rdclass;
- result = dns_message_gettempname(message, &tempname);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettempname(message, &tempname);
- result = dns_message_gettemprdataset(message, &temprdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdataset(message, &temprdataset);
/*
* Make question.
goto done;
}
- result = dns_message_gettempname(message, &tempname);
- if (result != ISC_R_SUCCESS) {
- goto soa_cleanup;
- }
- result = dns_message_gettemprdata(message, &temprdata);
- if (result != ISC_R_SUCCESS) {
- goto soa_cleanup;
- }
- result = dns_message_gettemprdataset(message, &temprdataset);
- if (result != ISC_R_SUCCESS) {
- goto soa_cleanup;
- }
- result = dns_message_gettemprdatalist(message, &temprdatalist);
- if (result != ISC_R_SUCCESS) {
- goto soa_cleanup;
- }
+ dns_message_gettempname(message, &tempname);
+ dns_message_gettemprdata(message, &temprdata);
+ dns_message_gettemprdataset(message, &temprdataset);
+ dns_message_gettemprdatalist(message, &temprdatalist);
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read);
INSIST(zone->db != NULL); /* XXXJT: is this assumption correct? */
done:
*messagep = message;
return (ISC_R_SUCCESS);
-
-cleanup:
- if (tempname != NULL) {
- dns_message_puttempname(message, &tempname);
- }
- if (temprdataset != NULL) {
- dns_message_puttemprdataset(message, &temprdataset);
- }
- dns_message_detach(&message);
- return (result);
}
isc_result_t
return (ISC_R_SUCCESS);
}
-static isc_result_t
+static void
checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep) {
dns_message_t *message = NULL;
dns_name_t *tempname = NULL;
dns_rdataset_t *temprdataset = NULL;
- isc_result_t result;
-
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(messagep != NULL && *messagep == NULL);
message->opcode = dns_opcode_query;
message->rdclass = zone->rdclass;
- result = dns_message_gettempname(message, &tempname);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettempname(message, &tempname);
- result = dns_message_gettemprdataset(message, &temprdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdataset(message, &temprdataset);
/*
* Make question.
temprdataset = NULL;
*messagep = message;
- return (ISC_R_SUCCESS);
-
-cleanup:
- if (tempname != NULL) {
- dns_message_puttempname(message, &tempname);
- }
- if (temprdataset != NULL) {
- dns_message_puttemprdataset(message, &temprdataset);
- }
- dns_message_detach(&message);
- return (result);
}
static void
goto cleanup;
}
- result = checkds_createmessage(checkds->zone, &message);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ checkds_createmessage(checkds->zone, &message);
isc_sockaddr_format(&checkds->dst, addrbuf, sizeof(addrbuf));
if (checkds->key != NULL) {
dns_rdataset_t *
ns_client_newrdataset(ns_client_t *client) {
dns_rdataset_t *rdataset;
- isc_result_t result;
REQUIRE(NS_CLIENT_VALID(client));
rdataset = NULL;
- result = dns_message_gettemprdataset(client->message, &rdataset);
- if (result != ISC_R_SUCCESS) {
- return (NULL);
- }
+ dns_message_gettemprdataset(client->message, &rdataset);
return (rdataset);
}
ns_client_newname(ns_client_t *client, isc_buffer_t *dbuf, isc_buffer_t *nbuf) {
dns_name_t *name = NULL;
isc_region_t r;
- isc_result_t result;
REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) == 0);
CTRACE("ns_client_newname");
- result = dns_message_gettempname(client->message, &name);
- if (result != ISC_R_SUCCESS) {
- CTRACE("ns_client_newname: "
- "dns_message_gettempname failed: done");
- return (NULL);
- }
+ dns_message_gettempname(client->message, &name);
isc_buffer_availableregion(dbuf, &r);
isc_buffer_init(nbuf, r.base, r.length);
dns_name_setbuffer(name, NULL);
isc_buffer_allocate(client->manager->mctx, &buffer,
view->dns64cnt * 16 *
dns_rdataset_count(qctx->rdataset));
- result = dns_message_gettemprdataset(client->message, &dns64_rdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_gettemprdatalist(client->message,
- &dns64_rdatalist);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdataset(client->message, &dns64_rdataset);
+ dns_message_gettemprdatalist(client->message, &dns64_rdatalist);
dns_rdatalist_init(dns64_rdatalist);
dns64_rdatalist->rdclass = dns_rdataclass_in;
isc_buffer_add(buffer, 16);
isc_buffer_remainingregion(buffer, &r);
isc_buffer_forward(buffer, 16);
- result = dns_message_gettemprdata(client->message,
- &dns64_rdata);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdata(client->message, &dns64_rdata);
dns_rdata_init(dns64_rdata);
dns_rdata_fromregion(dns64_rdata, dns_rdataclass_in,
dns_rdatatype_aaaa, &r);
isc_buffer_allocate(client->manager->mctx, &buffer,
16 * dns_rdataset_count(qctx->rdataset));
- result = dns_message_gettemprdataset(client->message, &myrdataset);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
- result = dns_message_gettemprdatalist(client->message, &myrdatalist);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdataset(client->message, &myrdataset);
+ dns_message_gettemprdatalist(client->message, &myrdatalist);
dns_rdatalist_init(myrdatalist);
myrdatalist->rdclass = dns_rdataclass_in;
isc_buffer_putmem(buffer, rdata.data, rdata.length);
isc_buffer_remainingregion(buffer, &r);
isc_buffer_forward(buffer, rdata.length);
- result = dns_message_gettemprdata(client->message, &myrdata);
- if (result != ISC_R_SUCCESS) {
- goto cleanup;
- }
+ dns_message_gettemprdata(client->message, &myrdata);
dns_rdata_init(myrdata);
dns_rdata_fromregion(myrdata, dns_rdataclass_in,
dns_rdatatype_aaaa, &r);
* Reset qname to be the target name of the CNAME and restart
* the query.
*/
- result = dns_message_gettempname(qctx->client->message, &tname);
- if (result != ISC_R_SUCCESS) {
- return (result);
- }
+ dns_message_gettempname(qctx->client->message, &tname);
result = dns_rdataset_first(rdataset);
if (result != ISC_R_SUCCESS) {
* Reset qname to be the target name of the CNAME and restart
* the query.
*/
- result = dns_message_gettempname(qctx->client->message, &tname);
- if (result != ISC_R_SUCCESS) {
- return (ns_query_done(qctx));
- }
+ dns_message_gettempname(qctx->client->message, &tname);
result = dns_rdataset_first(trdataset);
if (result != ISC_R_SUCCESS) {
* Get the target name of the DNAME.
*/
tname = NULL;
- result = dns_message_gettempname(qctx->client->message, &tname);
- if (result != ISC_R_SUCCESS) {
- return (ns_query_done(qctx));
- }
+ dns_message_gettempname(qctx->client->message, &tname);
result = dns_rdataset_first(trdataset);
if (result != ISC_R_SUCCESS) {
dns_rdata_t *rdata = NULL;
isc_region_t r;
dns_name_t *aname = NULL;
- isc_result_t result;
- result = dns_message_gettempname(client->message, &aname);
- if (result != ISC_R_SUCCESS) {
- return (result);
- }
+ dns_message_gettempname(client->message, &aname);
dns_name_copy(client->query.qname, aname);
- result = dns_message_gettemprdatalist(client->message, &rdatalist);
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(client->message, &aname);
- return (result);
- }
+ dns_message_gettemprdatalist(client->message, &rdatalist);
- result = dns_message_gettemprdata(client->message, &rdata);
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(client->message, &aname);
- dns_message_puttemprdatalist(client->message, &rdatalist);
- return (result);
- }
+ dns_message_gettemprdata(client->message, &rdata);
- result = dns_message_gettemprdataset(client->message, &rdataset);
- if (result != ISC_R_SUCCESS) {
- dns_message_puttempname(client->message, &aname);
- dns_message_puttemprdatalist(client->message, &rdatalist);
- dns_message_puttemprdata(client->message, &rdata);
- return (result);
- }
+ dns_message_gettemprdataset(client->message, &rdataset);
rdatalist->type = dns_rdatatype_cname;
rdatalist->rdclass = client->message->rdclass;
/*
* Get resources and make 'name' be the database origin.
*/
- result = dns_message_gettempname(client->message, &name);
- if (result != ISC_R_SUCCESS) {
- return (result);
- }
+ dns_message_gettempname(client->message, &name);
/*
* We'll be releasing 'name' before returning, so it's safe to
/*
* Get resources and make 'name' be the database origin.
*/
- result = dns_message_gettempname(client->message, &name);
- if (result != ISC_R_SUCCESS) {
- CTRACE(ISC_LOG_DEBUG(3), "query_addns: dns_message_gettempname "
- "failed: done");
- return (result);
- }
+ dns_message_gettempname(client->message, &name);
dns_name_clone(dns_db_origin(qctx->db), name);
rdataset = ns_client_newrdataset(client);
if (rdataset == NULL) {
/*
* Allocate structures required to construct the query.
*/
- result = dns_message_gettemprdataset(message, &qrdataset);
- if (result != ISC_R_SUCCESS) {
- goto destroy_message;
- }
- result = dns_message_gettempname(message, &qname);
- if (result != ISC_R_SUCCESS) {
- goto put_rdataset;
- }
+ dns_message_gettemprdataset(message, &qrdataset);
+ dns_message_gettempname(message, &qname);
/*
* Convert "qnamestr" to a DNS name, create a question rdataset of
put_name:
dns_message_puttempname(message, &qname);
-put_rdataset:
dns_message_puttemprdataset(message, &qrdataset);
destroy_message:
dns_message_detach(&message);
isc_buffer_add(&xfr->buf, 12 + 4);
qrdataset = NULL;
- result = dns_message_gettemprdataset(msg, &qrdataset);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ dns_message_gettemprdataset(msg, &qrdataset);
dns_rdataset_makequestion(qrdataset,
xfr->client->message->rdclass,
xfr->qtype);
- result = dns_message_gettempname(msg, &qname);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ dns_message_gettempname(msg, &qname);
isc_buffer_availableregion(&xfr->buf, &r);
INSIST(r.length >= xfr->qname->length);
r.length = xfr->qname->length;
log_rr(name, rdata, ttl); /* XXX */
}
- result = dns_message_gettempname(msg, &msgname);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ dns_message_gettempname(msg, &msgname);
isc_buffer_availableregion(&xfr->buf, &r);
INSIST(r.length >= name->length);
r.length = name->length;
/* Reserve space for RR header. */
isc_buffer_add(&xfr->buf, 10);
- result = dns_message_gettemprdata(msg, &msgrdata);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ dns_message_gettemprdata(msg, &msgrdata);
isc_buffer_availableregion(&xfr->buf, &r);
r.length = rdata->length;
isc_buffer_putmem(&xfr->buf, rdata->data, rdata->length);
dns_rdata_init(msgrdata);
dns_rdata_fromregion(msgrdata, rdata->rdclass, rdata->type, &r);
- result = dns_message_gettemprdatalist(msg, &msgrdl);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ dns_message_gettemprdatalist(msg, &msgrdl);
msgrdl->type = rdata->type;
msgrdl->rdclass = rdata->rdclass;
msgrdl->ttl = ttl;
}
ISC_LIST_APPEND(msgrdl->rdata, msgrdata, link);
- result = dns_message_gettemprdataset(msg, &msgrds);
- if (result != ISC_R_SUCCESS) {
- goto failure;
- }
+ dns_message_gettemprdataset(msg, &msgrds);
result = dns_rdatalist_tordataset(msgrdl, msgrds);
INSIST(result == ISC_R_SUCCESS);