mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 18:19:42 +00:00
Cleanup dns_message_gettemp*() functions - they cannot fail
The dns_message_gettempname(), dns_message_gettemprdata(), dns_message_gettemprdataset(), and dns_message_gettemprdatalist() always succeeds because the memory allocation cannot fail now. Change the API to return void and cleanup all the use of aforementioned functions.
This commit is contained in:
parent
edbb52c95c
commit
33ba0057a7
@ -1512,12 +1512,10 @@ static void
|
|||||||
add_question(dns_message_t *message, dns_name_t *name, dns_rdataclass_t rdclass,
|
add_question(dns_message_t *message, dns_name_t *name, dns_rdataclass_t rdclass,
|
||||||
dns_rdatatype_t rdtype) {
|
dns_rdatatype_t rdtype) {
|
||||||
dns_rdataset_t *rdataset;
|
dns_rdataset_t *rdataset;
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
debug("add_question()");
|
debug("add_question()");
|
||||||
rdataset = NULL;
|
rdataset = NULL;
|
||||||
result = dns_message_gettemprdataset(message, &rdataset);
|
dns_message_gettemprdataset(message, &rdataset);
|
||||||
check_result(result, "dns_message_gettemprdataset()");
|
|
||||||
dns_rdataset_makequestion(rdataset, rdclass, rdtype);
|
dns_rdataset_makequestion(rdataset, rdclass, rdtype);
|
||||||
ISC_LIST_APPEND(name->list, rdataset, link);
|
ISC_LIST_APPEND(name->list, rdataset, link);
|
||||||
}
|
}
|
||||||
@ -2106,18 +2104,15 @@ insert_soa(dig_lookup_t *lookup) {
|
|||||||
isc_buffer_init(&lookup->rdatabuf, lookup->rdatastore,
|
isc_buffer_init(&lookup->rdatabuf, lookup->rdatastore,
|
||||||
sizeof(lookup->rdatastore));
|
sizeof(lookup->rdatastore));
|
||||||
|
|
||||||
result = dns_message_gettemprdata(lookup->sendmsg, &rdata);
|
dns_message_gettemprdata(lookup->sendmsg, &rdata);
|
||||||
check_result(result, "dns_message_gettemprdata");
|
|
||||||
|
|
||||||
result = dns_rdata_fromstruct(rdata, lookup->rdclass, dns_rdatatype_soa,
|
result = dns_rdata_fromstruct(rdata, lookup->rdclass, dns_rdatatype_soa,
|
||||||
&soa, &lookup->rdatabuf);
|
&soa, &lookup->rdatabuf);
|
||||||
check_result(result, "isc_rdata_fromstruct");
|
check_result(result, "isc_rdata_fromstruct");
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist);
|
dns_message_gettemprdatalist(lookup->sendmsg, &rdatalist);
|
||||||
check_result(result, "dns_message_gettemprdatalist");
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(lookup->sendmsg, &rdataset);
|
dns_message_gettemprdataset(lookup->sendmsg, &rdataset);
|
||||||
check_result(result, "dns_message_gettemprdataset");
|
|
||||||
|
|
||||||
dns_rdatalist_init(rdatalist);
|
dns_rdatalist_init(rdatalist);
|
||||||
rdatalist->type = dns_rdatatype_soa;
|
rdatalist->type = dns_rdatatype_soa;
|
||||||
@ -2126,8 +2121,7 @@ insert_soa(dig_lookup_t *lookup) {
|
|||||||
|
|
||||||
dns_rdatalist_tordataset(rdatalist, rdataset);
|
dns_rdatalist_tordataset(rdatalist, rdataset);
|
||||||
|
|
||||||
result = dns_message_gettempname(lookup->sendmsg, &soaname);
|
dns_message_gettempname(lookup->sendmsg, &soaname);
|
||||||
check_result(result, "dns_message_gettempname");
|
|
||||||
dns_name_clone(lookup->name, soaname);
|
dns_name_clone(lookup->name, soaname);
|
||||||
ISC_LIST_INIT(soaname->list);
|
ISC_LIST_INIT(soaname->list);
|
||||||
ISC_LIST_APPEND(soaname->list, rdataset, link);
|
ISC_LIST_APPEND(soaname->list, rdataset, link);
|
||||||
@ -2222,8 +2216,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||||||
debug("cloning server list");
|
debug("cloning server list");
|
||||||
clone_server_list(server_list, &lookup->my_server_list);
|
clone_server_list(server_list, &lookup->my_server_list);
|
||||||
}
|
}
|
||||||
result = dns_message_gettempname(lookup->sendmsg, &lookup->name);
|
dns_message_gettempname(lookup->sendmsg, &lookup->name);
|
||||||
check_result(result, "dns_message_gettempname");
|
|
||||||
|
|
||||||
isc_buffer_init(&lookup->namebuf, lookup->name_space,
|
isc_buffer_init(&lookup->namebuf, lookup->name_space,
|
||||||
sizeof(lookup->name_space));
|
sizeof(lookup->name_space));
|
||||||
@ -2264,9 +2257,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||||||
|
|
||||||
if (lookup->origin != NULL) {
|
if (lookup->origin != NULL) {
|
||||||
debug("trying origin %s", lookup->origin->origin);
|
debug("trying origin %s", lookup->origin->origin);
|
||||||
result = dns_message_gettempname(lookup->sendmsg,
|
dns_message_gettempname(lookup->sendmsg, &lookup->oname);
|
||||||
&lookup->oname);
|
|
||||||
check_result(result, "dns_message_gettempname");
|
|
||||||
/* XXX Helper funct to conv char* to name? */
|
/* XXX Helper funct to conv char* to name? */
|
||||||
origin = lookup->origin->origin;
|
origin = lookup->origin->origin;
|
||||||
#ifdef HAVE_LIBIDN2
|
#ifdef HAVE_LIBIDN2
|
||||||
@ -2334,12 +2325,12 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||||||
result = dns_name_fromtext(lookup->name, &b,
|
result = dns_name_fromtext(lookup->name, &b,
|
||||||
dns_rootname, 0,
|
dns_rootname, 0,
|
||||||
&lookup->namebuf);
|
&lookup->namebuf);
|
||||||
}
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
dns_message_puttempname(lookup->sendmsg, &lookup->name);
|
dns_message_puttempname(lookup->sendmsg,
|
||||||
warn("'%s' is not a legal name "
|
&lookup->name);
|
||||||
"(%s)",
|
warn("'%s' is not a legal name (%s)",
|
||||||
lookup->textname, isc_result_totext(result));
|
lookup->textname,
|
||||||
|
isc_result_totext(result));
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
clear_current_lookup();
|
clear_current_lookup();
|
||||||
return (false);
|
return (false);
|
||||||
@ -2348,6 +2339,7 @@ setup_lookup(dig_lookup_t *lookup) {
|
|||||||
#endif /* if TARGET_OS_IPHONE */
|
#endif /* if TARGET_OS_IPHONE */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
dns_name_format(lookup->name, store, sizeof(store));
|
dns_name_format(lookup->name, store, sizeof(store));
|
||||||
dighost_trying(store, lookup);
|
dighost_trying(store, lookup);
|
||||||
INSIST(dns_name_isabsolute(lookup->name));
|
INSIST(dns_name_isabsolute(lookup->name));
|
||||||
|
@ -1239,8 +1239,7 @@ parse_name(char **cmdlinep, dns_message_t *msg, dns_name_t **namep) {
|
|||||||
return (STATUS_SYNTAX);
|
return (STATUS_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettempname(msg, namep);
|
dns_message_gettempname(msg, namep);
|
||||||
check_result(result, "dns_message_gettempname");
|
|
||||||
isc_buffer_init(&source, word, strlen(word));
|
isc_buffer_init(&source, word, strlen(word));
|
||||||
isc_buffer_add(&source, strlen(word));
|
isc_buffer_add(&source, strlen(word));
|
||||||
result = dns_name_fromtext(*namep, &source, dns_rootname, 0, NULL);
|
result = dns_name_fromtext(*namep, &source, dns_rootname, 0, NULL);
|
||||||
@ -1374,8 +1373,7 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
|
|||||||
rdatatype = dns_rdatatype_any;
|
rdatatype = dns_rdatatype_any;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettemprdata(updatemsg, &rdata);
|
dns_message_gettemprdata(updatemsg, &rdata);
|
||||||
check_result(result, "dns_message_gettemprdata");
|
|
||||||
|
|
||||||
dns_rdata_init(rdata);
|
dns_rdata_init(rdata);
|
||||||
|
|
||||||
@ -1389,10 +1387,8 @@ make_prereq(char *cmdline, bool ispositive, bool isrrset) {
|
|||||||
rdata->flags = DNS_RDATA_UPDATE;
|
rdata->flags = DNS_RDATA_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(updatemsg, &rdatalist);
|
dns_message_gettemprdatalist(updatemsg, &rdatalist);
|
||||||
check_result(result, "dns_message_gettemprdatalist");
|
dns_message_gettemprdataset(updatemsg, &rdataset);
|
||||||
result = dns_message_gettemprdataset(updatemsg, &rdataset);
|
|
||||||
check_result(result, "dns_message_gettemprdataset");
|
|
||||||
rdatalist->type = rdatatype;
|
rdatalist->type = rdatatype;
|
||||||
if (ispositive) {
|
if (ispositive) {
|
||||||
if (isrrset && rdata->data != NULL) {
|
if (isrrset && rdata->data != NULL) {
|
||||||
@ -1776,8 +1772,7 @@ update_addordelete(char *cmdline, bool isdelete) {
|
|||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettemprdata(updatemsg, &rdata);
|
dns_message_gettemprdata(updatemsg, &rdata);
|
||||||
check_result(result, "dns_message_gettemprdata");
|
|
||||||
|
|
||||||
dns_rdata_init(rdata);
|
dns_rdata_init(rdata);
|
||||||
|
|
||||||
@ -1939,10 +1934,8 @@ parseclass:
|
|||||||
|
|
||||||
doneparsing:
|
doneparsing:
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(updatemsg, &rdatalist);
|
dns_message_gettemprdatalist(updatemsg, &rdatalist);
|
||||||
check_result(result, "dns_message_gettemprdatalist");
|
dns_message_gettemprdataset(updatemsg, &rdataset);
|
||||||
result = dns_message_gettemprdataset(updatemsg, &rdataset);
|
|
||||||
check_result(result, "dns_message_gettemprdataset");
|
|
||||||
rdatalist->type = rdatatype;
|
rdatalist->type = rdatatype;
|
||||||
rdatalist->rdclass = rdataclass;
|
rdatalist->rdclass = rdataclass;
|
||||||
rdatalist->covers = rdatatype;
|
rdatalist->covers = rdatatype;
|
||||||
@ -2033,11 +2026,9 @@ setzone(dns_name_t *zonename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (zonename != NULL) {
|
if (zonename != NULL) {
|
||||||
result = dns_message_gettempname(updatemsg, &name);
|
dns_message_gettempname(updatemsg, &name);
|
||||||
check_result(result, "dns_message_gettempname");
|
|
||||||
dns_name_clone(zonename, name);
|
dns_name_clone(zonename, name);
|
||||||
result = dns_message_gettemprdataset(updatemsg, &rdataset);
|
dns_message_gettemprdataset(updatemsg, &rdataset);
|
||||||
check_result(result, "dns_message_gettemprdataset");
|
|
||||||
dns_rdataset_makequestion(rdataset, getzoneclass(),
|
dns_rdataset_makequestion(rdataset, getzoneclass(),
|
||||||
dns_rdatatype_soa);
|
dns_rdatatype_soa);
|
||||||
ISC_LIST_INIT(name->list);
|
ISC_LIST_INIT(name->list);
|
||||||
@ -3225,11 +3216,9 @@ start_update(void) {
|
|||||||
soaquery->flags |= DNS_MESSAGEFLAG_RD;
|
soaquery->flags |= DNS_MESSAGEFLAG_RD;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettempname(soaquery, &name);
|
dns_message_gettempname(soaquery, &name);
|
||||||
check_result(result, "dns_message_gettempname");
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(soaquery, &rdataset);
|
dns_message_gettemprdataset(soaquery, &rdataset);
|
||||||
check_result(result, "dns_message_gettemprdataset");
|
|
||||||
|
|
||||||
dns_rdataset_makequestion(rdataset, getzoneclass(), dns_rdatatype_soa);
|
dns_rdataset_makequestion(rdataset, getzoneclass(), dns_rdatatype_soa);
|
||||||
|
|
||||||
|
@ -157,11 +157,9 @@ sendquery(isc_task_t *task) {
|
|||||||
message->rdclass = dns_rdataclass_in;
|
message->rdclass = dns_rdataclass_in;
|
||||||
message->id = (unsigned short)(random() & 0xFFFF);
|
message->id = (unsigned short)(random() & 0xFFFF);
|
||||||
|
|
||||||
result = dns_message_gettempname(message, &qname);
|
dns_message_gettempname(message, &qname);
|
||||||
CHECK("dns_message_gettempname", result);
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(message, &qrdataset);
|
dns_message_gettemprdataset(message, &qrdataset);
|
||||||
CHECK("dns_message_gettemprdataset", result);
|
|
||||||
|
|
||||||
dns_name_clone(dns_fixedname_name(&queryname), qname);
|
dns_name_clone(dns_fixedname_name(&queryname), qname);
|
||||||
dns_rdataset_makequestion(qrdataset, dns_rdataclass_in,
|
dns_rdataset_makequestion(qrdataset, dns_rdataclass_in,
|
||||||
|
@ -619,11 +619,9 @@ sendquery(struct query *query, isc_task_t *task) {
|
|||||||
message->rdclass = query->rdclass;
|
message->rdclass = query->rdclass;
|
||||||
message->id = (unsigned short)(random() & 0xFFFF);
|
message->id = (unsigned short)(random() & 0xFFFF);
|
||||||
|
|
||||||
result = dns_message_gettempname(message, &qname);
|
dns_message_gettempname(message, &qname);
|
||||||
CHECK("dns_message_gettempname", result);
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(message, &qrdataset);
|
dns_message_gettemprdataset(message, &qrdataset);
|
||||||
CHECK("dns_message_gettemprdataset", result);
|
|
||||||
|
|
||||||
dns_name_clone(dns_fixedname_name(&queryname), qname);
|
dns_name_clone(dns_fixedname_name(&queryname), qname);
|
||||||
dns_rdataset_makequestion(qrdataset, query->rdclass, query->rdtype);
|
dns_rdataset_makequestion(qrdataset, query->rdclass, query->rdtype);
|
||||||
|
155
cocci/dns_message_gettemp.disabled
Normal file
155
cocci/dns_message_gettemp.disabled
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
@@
|
||||||
|
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);
|
@ -1026,7 +1026,7 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) {
|
|||||||
dst_context_destroy(&ctx);
|
dst_context_destroy(&ctx);
|
||||||
|
|
||||||
rdata = NULL;
|
rdata = NULL;
|
||||||
RETERR(dns_message_gettemprdata(msg, &rdata));
|
dns_message_gettemprdata(msg, &rdata);
|
||||||
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
|
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
|
||||||
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||||
dns_rdatatype_sig /* SIG(0) */, &sig,
|
dns_rdatatype_sig /* SIG(0) */, &sig,
|
||||||
@ -1037,12 +1037,12 @@ dns_dnssec_signmessage(dns_message_t *msg, dst_key_t *key) {
|
|||||||
dns_message_takebuffer(msg, &dynbuf);
|
dns_message_takebuffer(msg, &dynbuf);
|
||||||
|
|
||||||
datalist = NULL;
|
datalist = NULL;
|
||||||
RETERR(dns_message_gettemprdatalist(msg, &datalist));
|
dns_message_gettemprdatalist(msg, &datalist);
|
||||||
datalist->rdclass = dns_rdataclass_any;
|
datalist->rdclass = dns_rdataclass_any;
|
||||||
datalist->type = dns_rdatatype_sig; /* SIG(0) */
|
datalist->type = dns_rdatatype_sig; /* SIG(0) */
|
||||||
ISC_LIST_APPEND(datalist->rdata, rdata, link);
|
ISC_LIST_APPEND(datalist->rdata, rdata, link);
|
||||||
dataset = NULL;
|
dataset = NULL;
|
||||||
RETERR(dns_message_gettemprdataset(msg, &dataset));
|
dns_message_gettemprdataset(msg, &dataset);
|
||||||
RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) ==
|
RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset) ==
|
||||||
ISC_R_SUCCESS);
|
ISC_R_SUCCESS);
|
||||||
msg->sig0 = dataset;
|
msg->sig0 = dataset;
|
||||||
|
@ -931,7 +931,7 @@ dns_message_removename(dns_message_t *msg, dns_name_t *name,
|
|||||||
* reset, and must NOT be used after these operations.
|
* reset, and must NOT be used after these operations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_message_gettempname(dns_message_t *msg, dns_name_t **item);
|
dns_message_gettempname(dns_message_t *msg, dns_name_t **item);
|
||||||
/*%<
|
/*%<
|
||||||
* Return a name that can be used for any temporary purpose, including
|
* Return a name that can be used for any temporary purpose, including
|
||||||
@ -946,12 +946,9 @@ dns_message_gettempname(dns_message_t *msg, dns_name_t **item);
|
|||||||
*\li msg be a valid message
|
*\li msg be a valid message
|
||||||
*
|
*
|
||||||
*\li item != NULL && *item == NULL
|
*\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);
|
dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item);
|
||||||
/*%<
|
/*%<
|
||||||
* Return a rdata that can be used for any temporary purpose, including
|
* Return a rdata that can be used for any temporary purpose, including
|
||||||
@ -962,12 +959,9 @@ dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item);
|
|||||||
*\li msg be a valid message
|
*\li msg be a valid message
|
||||||
*
|
*
|
||||||
*\li item != NULL && *item == NULL
|
*\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);
|
dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item);
|
||||||
/*%<
|
/*%<
|
||||||
* Return a rdataset that can be used for any temporary purpose, including
|
* Return a rdataset that can be used for any temporary purpose, including
|
||||||
@ -979,12 +973,9 @@ dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item);
|
|||||||
*\li msg be a valid message
|
*\li msg be a valid message
|
||||||
*
|
*
|
||||||
*\li item != NULL && *item == NULL
|
*\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);
|
dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item);
|
||||||
/*%<
|
/*%<
|
||||||
* Return a rdatalist that can be used for any temporary purpose, including
|
* Return a rdatalist that can be used for any temporary purpose, including
|
||||||
@ -995,9 +986,6 @@ dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item);
|
|||||||
*\li msg be a valid message
|
*\li msg be a valid message
|
||||||
*
|
*
|
||||||
*\li item != NULL && *item == NULL
|
*\li item != NULL && *item == NULL
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
*\li #ISC_R_SUCCESS -- All is well.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -978,10 +978,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
|||||||
|
|
||||||
for (count = 0; count < msg->counts[DNS_SECTION_QUESTION]; count++) {
|
for (count = 0; count < msg->counts[DNS_SECTION_QUESTION]; count++) {
|
||||||
name = NULL;
|
name = NULL;
|
||||||
result = dns_message_gettempname(msg, &name);
|
dns_message_gettempname(msg, &name);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
name->offsets = (unsigned char *)newoffsets(msg);
|
name->offsets = (unsigned char *)newoffsets(msg);
|
||||||
free_name = true;
|
free_name = true;
|
||||||
|
|
||||||
@ -1209,10 +1206,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
|||||||
istsig = false;
|
istsig = false;
|
||||||
|
|
||||||
name = NULL;
|
name = NULL;
|
||||||
result = dns_message_gettempname(msg, &name);
|
dns_message_gettempname(msg, &name);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
name->offsets = (unsigned char *)newoffsets(msg);
|
name->offsets = (unsigned char *)newoffsets(msg);
|
||||||
free_name = true;
|
free_name = true;
|
||||||
|
|
||||||
@ -2529,7 +2523,7 @@ dns_message_removename(dns_message_t *msg, dns_name_t *name,
|
|||||||
ISC_LIST_UNLINK(msg->sections[section], name, link);
|
ISC_LIST_UNLINK(msg->sections[section], name, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_message_gettempname(dns_message_t *msg, dns_name_t **item) {
|
dns_message_gettempname(dns_message_t *msg, dns_name_t **item) {
|
||||||
dns_fixedname_t *fn = NULL;
|
dns_fixedname_t *fn = NULL;
|
||||||
|
|
||||||
@ -2538,36 +2532,31 @@ dns_message_gettempname(dns_message_t *msg, dns_name_t **item) {
|
|||||||
|
|
||||||
fn = isc_mempool_get(msg->namepool);
|
fn = isc_mempool_get(msg->namepool);
|
||||||
*item = dns_fixedname_initname(fn);
|
*item = dns_fixedname_initname(fn);
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item) {
|
dns_message_gettemprdata(dns_message_t *msg, dns_rdata_t **item) {
|
||||||
REQUIRE(DNS_MESSAGE_VALID(msg));
|
REQUIRE(DNS_MESSAGE_VALID(msg));
|
||||||
REQUIRE(item != NULL && *item == NULL);
|
REQUIRE(item != NULL && *item == NULL);
|
||||||
|
|
||||||
*item = newrdata(msg);
|
*item = newrdata(msg);
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) {
|
dns_message_gettemprdataset(dns_message_t *msg, dns_rdataset_t **item) {
|
||||||
REQUIRE(DNS_MESSAGE_VALID(msg));
|
REQUIRE(DNS_MESSAGE_VALID(msg));
|
||||||
REQUIRE(item != NULL && *item == NULL);
|
REQUIRE(item != NULL && *item == NULL);
|
||||||
|
|
||||||
*item = isc_mempool_get(msg->rdspool);
|
*item = isc_mempool_get(msg->rdspool);
|
||||||
dns_rdataset_init(*item);
|
dns_rdataset_init(*item);
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
void
|
||||||
dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) {
|
dns_message_gettemprdatalist(dns_message_t *msg, dns_rdatalist_t **item) {
|
||||||
REQUIRE(DNS_MESSAGE_VALID(msg));
|
REQUIRE(DNS_MESSAGE_VALID(msg));
|
||||||
REQUIRE(item != NULL && *item == NULL);
|
REQUIRE(item != NULL && *item == NULL);
|
||||||
|
|
||||||
*item = newrdatalist(msg);
|
*item = newrdatalist(msg);
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2867,19 +2856,10 @@ dns_message_setquerytsig(dns_message_t *msg, isc_buffer_t *querytsig) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettemprdata(msg, &rdata);
|
dns_message_gettemprdata(msg, &rdata);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(msg, &list);
|
dns_message_gettemprdatalist(msg, &list);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettemprdataset(msg, &set);
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
result = dns_message_gettemprdataset(msg, &set);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_buffer_usedregion(querytsig, &r);
|
isc_buffer_usedregion(querytsig, &r);
|
||||||
isc_buffer_allocate(msg->mctx, &buf, r.length);
|
isc_buffer_allocate(msg->mctx, &buf, r.length);
|
||||||
@ -4589,18 +4569,9 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp,
|
|||||||
REQUIRE(DNS_MESSAGE_VALID(message));
|
REQUIRE(DNS_MESSAGE_VALID(message));
|
||||||
REQUIRE(rdatasetp != NULL && *rdatasetp == NULL);
|
REQUIRE(rdatasetp != NULL && *rdatasetp == NULL);
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(message, &rdatalist);
|
dns_message_gettemprdatalist(message, &rdatalist);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettemprdata(message, &rdata);
|
||||||
return (result);
|
dns_message_gettemprdataset(message, &rdataset);
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
rdatalist->type = dns_rdatatype_opt;
|
rdatalist->type = dns_rdatatype_opt;
|
||||||
|
|
||||||
|
@ -9699,7 +9699,6 @@ rdataset_addglue(dns_rdataset_t *rdataset, dns_dbversion_t *version,
|
|||||||
bool restarted = false;
|
bool restarted = false;
|
||||||
rbtdb_glue_t *ge;
|
rbtdb_glue_t *ge;
|
||||||
rbtdb_glue_additionaldata_ctx_t ctx;
|
rbtdb_glue_additionaldata_ctx_t ctx;
|
||||||
isc_result_t result;
|
|
||||||
uint64_t hash;
|
uint64_t hash;
|
||||||
|
|
||||||
REQUIRE(rdataset->type == dns_rdatatype_ns);
|
REQUIRE(rdataset->type == dns_rdatatype_ns);
|
||||||
@ -9772,70 +9771,24 @@ restart:
|
|||||||
dns_rdataset_t *sigrdataset_aaaa = NULL;
|
dns_rdataset_t *sigrdataset_aaaa = NULL;
|
||||||
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
|
dns_name_t *gluename = dns_fixedname_name(&ge->fixedname);
|
||||||
|
|
||||||
result = dns_message_gettempname(msg, &name);
|
dns_message_gettempname(msg, &name);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto no_glue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_name_copy(gluename, name);
|
dns_name_copy(gluename, name);
|
||||||
|
|
||||||
if (dns_rdataset_isassociated(&ge->rdataset_a)) {
|
if (dns_rdataset_isassociated(&ge->rdataset_a)) {
|
||||||
result = dns_message_gettemprdataset(msg, &rdataset_a);
|
dns_message_gettemprdataset(msg, &rdataset_a);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
dns_message_puttempname(msg, &name);
|
|
||||||
goto no_glue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dns_rdataset_isassociated(&ge->sigrdataset_a)) {
|
if (dns_rdataset_isassociated(&ge->sigrdataset_a)) {
|
||||||
result = dns_message_gettemprdataset(msg,
|
dns_message_gettemprdataset(msg, &sigrdataset_a);
|
||||||
&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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dns_rdataset_isassociated(&ge->rdataset_aaaa)) {
|
if (dns_rdataset_isassociated(&ge->rdataset_aaaa)) {
|
||||||
result = dns_message_gettemprdataset(msg,
|
dns_message_gettemprdataset(msg, &rdataset_aaaa);
|
||||||
&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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dns_rdataset_isassociated(&ge->sigrdataset_aaaa)) {
|
if (dns_rdataset_isassociated(&ge->sigrdataset_aaaa)) {
|
||||||
result = dns_message_gettemprdataset(msg,
|
dns_message_gettemprdataset(msg, &sigrdataset_aaaa);
|
||||||
&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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rdataset_a != NULL) {
|
if (rdataset_a != NULL) {
|
||||||
|
@ -2456,14 +2456,8 @@ resquery_send(resquery_t *query) {
|
|||||||
return (ISC_R_SHUTTINGDOWN);
|
return (ISC_R_SHUTTINGDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettempname(fctx->qmessage, &qname);
|
dns_message_gettempname(fctx->qmessage, &qname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettemprdataset(fctx->qmessage, &qrdataset);
|
||||||
goto cleanup_temps;
|
|
||||||
}
|
|
||||||
result = dns_message_gettemprdataset(fctx->qmessage, &qrdataset);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup_temps;
|
|
||||||
}
|
|
||||||
|
|
||||||
fctx->qmessage->opcode = dns_opcode_query;
|
fctx->qmessage->opcode = dns_opcode_query;
|
||||||
|
|
||||||
@ -2474,8 +2468,6 @@ resquery_send(resquery_t *query) {
|
|||||||
dns_rdataset_makequestion(qrdataset, res->rdclass, fctx->type);
|
dns_rdataset_makequestion(qrdataset, res->rdclass, fctx->type);
|
||||||
ISC_LIST_APPEND(qname->list, qrdataset, link);
|
ISC_LIST_APPEND(qname->list, qrdataset, link);
|
||||||
dns_message_addname(fctx->qmessage, qname, DNS_SECTION_QUESTION);
|
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
|
* Set RD if the client has requested that we do a recursive
|
||||||
@ -2862,14 +2854,6 @@ cleanup_message:
|
|||||||
*/
|
*/
|
||||||
dns_dispatch_done(&query->dispentry);
|
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);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
|
|||||||
dns_rdataset_t *newset = NULL;
|
dns_rdataset_t *newset = NULL;
|
||||||
isc_buffer_t *tmprdatabuf = NULL;
|
isc_buffer_t *tmprdatabuf = NULL;
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdata(msg, &newrdata));
|
dns_message_gettemprdata(msg, &newrdata);
|
||||||
|
|
||||||
dns_rdata_toregion(rdata, &r);
|
dns_rdata_toregion(rdata, &r);
|
||||||
isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length);
|
isc_buffer_allocate(msg->mctx, &tmprdatabuf, r.length);
|
||||||
@ -176,16 +176,16 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
|
|||||||
dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr);
|
dns_rdata_fromregion(newrdata, rdata->rdclass, rdata->type, &newr);
|
||||||
dns_message_takebuffer(msg, &tmprdatabuf);
|
dns_message_takebuffer(msg, &tmprdatabuf);
|
||||||
|
|
||||||
RETERR(dns_message_gettempname(msg, &newname));
|
dns_message_gettempname(msg, &newname);
|
||||||
dns_name_copy(name, newname);
|
dns_name_copy(name, newname);
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdatalist(msg, &newlist));
|
dns_message_gettemprdatalist(msg, &newlist);
|
||||||
newlist->rdclass = newrdata->rdclass;
|
newlist->rdclass = newrdata->rdclass;
|
||||||
newlist->type = newrdata->type;
|
newlist->type = newrdata->type;
|
||||||
newlist->ttl = ttl;
|
newlist->ttl = ttl;
|
||||||
ISC_LIST_APPEND(newlist->rdata, newrdata, link);
|
ISC_LIST_APPEND(newlist->rdata, newrdata, link);
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdataset(msg, &newset));
|
dns_message_gettemprdataset(msg, &newset);
|
||||||
RETERR(dns_rdatalist_tordataset(newlist, newset));
|
RETERR(dns_rdatalist_tordataset(newlist, newset));
|
||||||
|
|
||||||
ISC_LIST_INIT(newname->list);
|
ISC_LIST_INIT(newname->list);
|
||||||
@ -960,27 +960,27 @@ buildquery(dns_message_t *msg, const dns_name_t *name, dns_rdata_tkey_t *tkey,
|
|||||||
REQUIRE(name != NULL);
|
REQUIRE(name != NULL);
|
||||||
REQUIRE(tkey != NULL);
|
REQUIRE(tkey != NULL);
|
||||||
|
|
||||||
RETERR(dns_message_gettempname(msg, &qname));
|
dns_message_gettempname(msg, &qname);
|
||||||
RETERR(dns_message_gettempname(msg, &aname));
|
dns_message_gettempname(msg, &aname);
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdataset(msg, &question));
|
dns_message_gettemprdataset(msg, &question);
|
||||||
dns_rdataset_makequestion(question, dns_rdataclass_any,
|
dns_rdataset_makequestion(question, dns_rdataclass_any,
|
||||||
dns_rdatatype_tkey);
|
dns_rdatatype_tkey);
|
||||||
|
|
||||||
len = 16 + tkey->algorithm.length + tkey->keylen + tkey->otherlen;
|
len = 16 + tkey->algorithm.length + tkey->keylen + tkey->otherlen;
|
||||||
isc_buffer_allocate(msg->mctx, &dynbuf, len);
|
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,
|
RETERR(dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||||
dns_rdatatype_tkey, tkey, dynbuf));
|
dns_rdatatype_tkey, tkey, dynbuf));
|
||||||
dns_message_takebuffer(msg, &dynbuf);
|
dns_message_takebuffer(msg, &dynbuf);
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdatalist(msg, &tkeylist));
|
dns_message_gettemprdatalist(msg, &tkeylist);
|
||||||
tkeylist->rdclass = dns_rdataclass_any;
|
tkeylist->rdclass = dns_rdataclass_any;
|
||||||
tkeylist->type = dns_rdatatype_tkey;
|
tkeylist->type = dns_rdatatype_tkey;
|
||||||
ISC_LIST_APPEND(tkeylist->rdata, rdata, link);
|
ISC_LIST_APPEND(tkeylist->rdata, rdata, link);
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdataset(msg, &tkeyset));
|
dns_message_gettemprdataset(msg, &tkeyset);
|
||||||
RETERR(dns_rdatalist_tordataset(tkeylist, tkeyset));
|
RETERR(dns_rdatalist_tordataset(tkeylist, tkeyset));
|
||||||
|
|
||||||
dns_name_copy(name, qname);
|
dns_name_copy(name, qname);
|
||||||
@ -1065,7 +1065,7 @@ dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key,
|
|||||||
|
|
||||||
RETERR(buildquery(msg, name, &tkey, false));
|
RETERR(buildquery(msg, name, &tkey, false));
|
||||||
|
|
||||||
RETERR(dns_message_gettemprdata(msg, &rdata));
|
dns_message_gettemprdata(msg, &rdata);
|
||||||
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
|
isc_buffer_allocate(msg->mctx, &dynbuf, 1024);
|
||||||
RETERR(dst_key_todns(key, dynbuf));
|
RETERR(dst_key_todns(key, dynbuf));
|
||||||
isc_buffer_usedregion(dynbuf, &r);
|
isc_buffer_usedregion(dynbuf, &r);
|
||||||
|
@ -996,10 +996,7 @@ dns_tsig_sign(dns_message_t *msg) {
|
|||||||
tsig.signature = NULL;
|
tsig.signature = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dns_message_gettemprdata(msg, &rdata);
|
dns_message_gettemprdata(msg, &rdata);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup_signature;
|
|
||||||
}
|
|
||||||
isc_buffer_allocate(msg->mctx, &dynbuf, 512);
|
isc_buffer_allocate(msg->mctx, &dynbuf, 512);
|
||||||
ret = dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
ret = dns_rdata_fromstruct(rdata, dns_rdataclass_any,
|
||||||
dns_rdatatype_tsig, &tsig, dynbuf);
|
dns_rdatatype_tsig, &tsig, dynbuf);
|
||||||
@ -1014,21 +1011,12 @@ dns_tsig_sign(dns_message_t *msg) {
|
|||||||
tsig.signature = NULL;
|
tsig.signature = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dns_message_gettempname(msg, &owner);
|
dns_message_gettempname(msg, &owner);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup_rdata;
|
|
||||||
}
|
|
||||||
dns_name_copy(&key->name, owner);
|
dns_name_copy(&key->name, owner);
|
||||||
|
|
||||||
ret = dns_message_gettemprdatalist(msg, &datalist);
|
dns_message_gettemprdatalist(msg, &datalist);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup_owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = dns_message_gettemprdataset(msg, &dataset);
|
dns_message_gettemprdataset(msg, &dataset);
|
||||||
if (ret != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup_rdatalist;
|
|
||||||
}
|
|
||||||
datalist->rdclass = dns_rdataclass_any;
|
datalist->rdclass = dns_rdataclass_any;
|
||||||
datalist->type = dns_rdatatype_tsig;
|
datalist->type = dns_rdatatype_tsig;
|
||||||
ISC_LIST_APPEND(datalist->rdata, rdata, link);
|
ISC_LIST_APPEND(datalist->rdata, rdata, link);
|
||||||
@ -1042,14 +1030,8 @@ dns_tsig_sign(dns_message_t *msg) {
|
|||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
cleanup_rdatalist:
|
|
||||||
dns_message_puttemprdatalist(msg, &datalist);
|
|
||||||
cleanup_owner:
|
|
||||||
dns_message_puttempname(msg, &owner);
|
|
||||||
goto cleanup_rdata;
|
|
||||||
cleanup_dynbuf:
|
cleanup_dynbuf:
|
||||||
isc_buffer_free(&dynbuf);
|
isc_buffer_free(&dynbuf);
|
||||||
cleanup_rdata:
|
|
||||||
dns_message_puttemprdata(msg, &rdata);
|
dns_message_puttemprdata(msg, &rdata);
|
||||||
cleanup_signature:
|
cleanup_signature:
|
||||||
if (tsig.signature != NULL) {
|
if (tsig.signature != NULL) {
|
||||||
|
@ -1237,21 +1237,21 @@ tuple2msgname(dns_difftuple_t *tuple, dns_message_t *msg, dns_name_t **target) {
|
|||||||
|
|
||||||
REQUIRE(target != NULL && *target == NULL);
|
REQUIRE(target != NULL && *target == NULL);
|
||||||
|
|
||||||
CHECK(dns_message_gettemprdata(msg, &rdata));
|
dns_message_gettemprdata(msg, &rdata);
|
||||||
dns_rdata_init(rdata);
|
dns_rdata_init(rdata);
|
||||||
dns_rdata_clone(&tuple->rdata, rdata);
|
dns_rdata_clone(&tuple->rdata, rdata);
|
||||||
|
|
||||||
CHECK(dns_message_gettemprdatalist(msg, &rdl));
|
dns_message_gettemprdatalist(msg, &rdl);
|
||||||
dns_rdatalist_init(rdl);
|
dns_rdatalist_init(rdl);
|
||||||
rdl->type = tuple->rdata.type;
|
rdl->type = tuple->rdata.type;
|
||||||
rdl->rdclass = tuple->rdata.rdclass;
|
rdl->rdclass = tuple->rdata.rdclass;
|
||||||
rdl->ttl = tuple->ttl;
|
rdl->ttl = tuple->ttl;
|
||||||
ISC_LIST_APPEND(rdl->rdata, rdata, link);
|
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_rdatalist_tordataset(rdl, rds));
|
||||||
|
|
||||||
CHECK(dns_message_gettempname(msg, &name));
|
dns_message_gettempname(msg, &name);
|
||||||
dns_name_clone(&tuple->name, name);
|
dns_name_clone(&tuple->name, name);
|
||||||
ISC_LIST_APPEND(name->list, rds, link);
|
ISC_LIST_APPEND(name->list, rds, link);
|
||||||
|
|
||||||
@ -1295,11 +1295,11 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) {
|
|||||||
CHECK(dns_message_settsigkey(msg, xfr->tsigkey));
|
CHECK(dns_message_settsigkey(msg, xfr->tsigkey));
|
||||||
|
|
||||||
/* Create a name for the question section. */
|
/* Create a name for the question section. */
|
||||||
CHECK(dns_message_gettempname(msg, &qname));
|
dns_message_gettempname(msg, &qname);
|
||||||
dns_name_clone(&xfr->name, qname);
|
dns_name_clone(&xfr->name, qname);
|
||||||
|
|
||||||
/* Formulate the question and attach it to the question name. */
|
/* 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);
|
dns_rdataset_makequestion(qrdataset, xfr->rdclass, xfr->reqtype);
|
||||||
ISC_LIST_APPEND(qname->list, qrdataset, link);
|
ISC_LIST_APPEND(qname->list, qrdataset, link);
|
||||||
qrdataset = NULL;
|
qrdataset = NULL;
|
||||||
|
107
lib/dns/zone.c
107
lib/dns/zone.c
@ -936,7 +936,7 @@ static void
|
|||||||
checkds_cancel(dns_zone_t *zone);
|
checkds_cancel(dns_zone_t *zone);
|
||||||
static void
|
static void
|
||||||
checkds_send(dns_zone_t *zone);
|
checkds_send(dns_zone_t *zone);
|
||||||
static isc_result_t
|
static void
|
||||||
checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep);
|
checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep);
|
||||||
static void
|
static void
|
||||||
checkds_done(isc_task_t *task, isc_event_t *event);
|
checkds_done(isc_task_t *task, isc_event_t *event);
|
||||||
@ -13031,28 +13031,21 @@ cleanup1:
|
|||||||
/***
|
/***
|
||||||
*** Private
|
*** Private
|
||||||
***/
|
***/
|
||||||
static isc_result_t
|
static void
|
||||||
create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, dns_name_t *name,
|
create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, dns_name_t *name,
|
||||||
dns_message_t **messagep) {
|
dns_message_t **messagep) {
|
||||||
dns_message_t *message = NULL;
|
dns_message_t *message = NULL;
|
||||||
dns_name_t *qname = NULL;
|
dns_name_t *qname = NULL;
|
||||||
dns_rdataset_t *qrdataset = NULL;
|
dns_rdataset_t *qrdataset = NULL;
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
dns_message_create(zone->mctx, DNS_MESSAGE_INTENTRENDER, &message);
|
dns_message_create(zone->mctx, DNS_MESSAGE_INTENTRENDER, &message);
|
||||||
|
|
||||||
message->opcode = dns_opcode_query;
|
message->opcode = dns_opcode_query;
|
||||||
message->rdclass = zone->rdclass;
|
message->rdclass = zone->rdclass;
|
||||||
|
|
||||||
result = dns_message_gettempname(message, &qname);
|
dns_message_gettempname(message, &qname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(message, &qrdataset);
|
dns_message_gettemprdataset(message, &qrdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make question.
|
* Make question.
|
||||||
@ -13063,17 +13056,6 @@ create_query(dns_zone_t *zone, dns_rdatatype_t rdtype, dns_name_t *name,
|
|||||||
dns_message_addname(message, qname, DNS_SECTION_QUESTION);
|
dns_message_addname(message, qname, DNS_SECTION_QUESTION);
|
||||||
|
|
||||||
*messagep = message;
|
*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
|
static isc_result_t
|
||||||
@ -13387,9 +13369,8 @@ stub_request_nameserver_address(struct stub_cb_args *args, bool ipv4,
|
|||||||
request->ipv4 = ipv4;
|
request->ipv4 = ipv4;
|
||||||
dns_name_dup(name, zone->mctx, &request->name);
|
dns_name_dup(name, zone->mctx, &request->name);
|
||||||
|
|
||||||
result = create_query(zone, ipv4 ? dns_rdatatype_a : dns_rdatatype_aaaa,
|
create_query(zone, ipv4 ? dns_rdatatype_a : dns_rdatatype_aaaa,
|
||||||
&request->name, &message);
|
&request->name, &message);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
|
||||||
|
|
||||||
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) {
|
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) {
|
||||||
result = add_opt(message, args->udpsize, args->reqnsid, false);
|
result = add_opt(message, args->udpsize, args->reqnsid, false);
|
||||||
@ -14629,10 +14610,7 @@ again:
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = create_query(zone, dns_rdatatype_soa, &zone->origin, &message);
|
create_query(zone, dns_rdatatype_soa, &zone->origin, &message);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) {
|
if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NOEDNS)) {
|
||||||
result = add_opt(message, udpsize, reqnsid, reqexpire);
|
result = add_opt(message, udpsize, reqnsid, reqexpire);
|
||||||
@ -14814,8 +14792,7 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
|
|||||||
/*
|
/*
|
||||||
* XXX Optimisation: Create message when zone is setup and reuse.
|
* XXX Optimisation: Create message when zone is setup and reuse.
|
||||||
*/
|
*/
|
||||||
result = create_query(zone, dns_rdatatype_ns, &zone->origin, &message);
|
create_query(zone, dns_rdatatype_ns, &zone->origin, &message);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
|
||||||
|
|
||||||
INSIST(zone->primariescnt > 0);
|
INSIST(zone->primariescnt > 0);
|
||||||
INSIST(zone->curprimary < zone->primariescnt);
|
INSIST(zone->curprimary < zone->primariescnt);
|
||||||
@ -15341,15 +15318,9 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags,
|
|||||||
message->flags |= DNS_MESSAGEFLAG_AA;
|
message->flags |= DNS_MESSAGEFLAG_AA;
|
||||||
message->rdclass = zone->rdclass;
|
message->rdclass = zone->rdclass;
|
||||||
|
|
||||||
result = dns_message_gettempname(message, &tempname);
|
dns_message_gettempname(message, &tempname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(message, &temprdataset);
|
dns_message_gettemprdataset(message, &temprdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make question.
|
* Make question.
|
||||||
@ -15366,22 +15337,10 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettempname(message, &tempname);
|
dns_message_gettempname(message, &tempname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettemprdata(message, &temprdata);
|
||||||
goto soa_cleanup;
|
dns_message_gettemprdataset(message, &temprdataset);
|
||||||
}
|
dns_message_gettemprdatalist(message, &temprdatalist);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read);
|
ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read);
|
||||||
INSIST(zone->db != NULL); /* XXXJT: is this assumption correct? */
|
INSIST(zone->db != NULL); /* XXXJT: is this assumption correct? */
|
||||||
@ -15461,16 +15420,6 @@ soa_cleanup:
|
|||||||
done:
|
done:
|
||||||
*messagep = message;
|
*messagep = message;
|
||||||
return (ISC_R_SUCCESS);
|
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
|
isc_result_t
|
||||||
@ -21085,15 +21034,13 @@ checkds_create(isc_mem_t *mctx, unsigned int flags, dns_checkds_t **checkdsp) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static void
|
||||||
checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep) {
|
checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep) {
|
||||||
dns_message_t *message = NULL;
|
dns_message_t *message = NULL;
|
||||||
|
|
||||||
dns_name_t *tempname = NULL;
|
dns_name_t *tempname = NULL;
|
||||||
dns_rdataset_t *temprdataset = NULL;
|
dns_rdataset_t *temprdataset = NULL;
|
||||||
|
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
REQUIRE(DNS_ZONE_VALID(zone));
|
REQUIRE(DNS_ZONE_VALID(zone));
|
||||||
REQUIRE(messagep != NULL && *messagep == NULL);
|
REQUIRE(messagep != NULL && *messagep == NULL);
|
||||||
|
|
||||||
@ -21102,15 +21049,9 @@ checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep) {
|
|||||||
message->opcode = dns_opcode_query;
|
message->opcode = dns_opcode_query;
|
||||||
message->rdclass = zone->rdclass;
|
message->rdclass = zone->rdclass;
|
||||||
|
|
||||||
result = dns_message_gettempname(message, &tempname);
|
dns_message_gettempname(message, &tempname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(message, &temprdataset);
|
dns_message_gettemprdataset(message, &temprdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make question.
|
* Make question.
|
||||||
@ -21125,17 +21066,6 @@ checkds_createmessage(dns_zone_t *zone, dns_message_t **messagep) {
|
|||||||
temprdataset = NULL;
|
temprdataset = NULL;
|
||||||
|
|
||||||
*messagep = message;
|
*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
|
static void
|
||||||
@ -21190,10 +21120,7 @@ checkds_send_toaddr(isc_task_t *task, isc_event_t *event) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = checkds_createmessage(checkds->zone, &message);
|
checkds_createmessage(checkds->zone, &message);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
isc_sockaddr_format(&checkds->dst, addrbuf, sizeof(addrbuf));
|
isc_sockaddr_format(&checkds->dst, addrbuf, sizeof(addrbuf));
|
||||||
if (checkds->key != NULL) {
|
if (checkds->key != NULL) {
|
||||||
|
@ -2778,15 +2778,11 @@ ns_client_sourceip(dns_clientinfo_t *ci, isc_sockaddr_t **addrp) {
|
|||||||
dns_rdataset_t *
|
dns_rdataset_t *
|
||||||
ns_client_newrdataset(ns_client_t *client) {
|
ns_client_newrdataset(ns_client_t *client) {
|
||||||
dns_rdataset_t *rdataset;
|
dns_rdataset_t *rdataset;
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
REQUIRE(NS_CLIENT_VALID(client));
|
REQUIRE(NS_CLIENT_VALID(client));
|
||||||
|
|
||||||
rdataset = NULL;
|
rdataset = NULL;
|
||||||
result = dns_message_gettemprdataset(client->message, &rdataset);
|
dns_message_gettemprdataset(client->message, &rdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (rdataset);
|
return (rdataset);
|
||||||
}
|
}
|
||||||
@ -2825,18 +2821,12 @@ dns_name_t *
|
|||||||
ns_client_newname(ns_client_t *client, isc_buffer_t *dbuf, isc_buffer_t *nbuf) {
|
ns_client_newname(ns_client_t *client, isc_buffer_t *dbuf, isc_buffer_t *nbuf) {
|
||||||
dns_name_t *name = NULL;
|
dns_name_t *name = NULL;
|
||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) == 0);
|
REQUIRE((client->query.attributes & NS_QUERYATTR_NAMEBUFUSED) == 0);
|
||||||
|
|
||||||
CTRACE("ns_client_newname");
|
CTRACE("ns_client_newname");
|
||||||
|
|
||||||
result = dns_message_gettempname(client->message, &name);
|
dns_message_gettempname(client->message, &name);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
CTRACE("ns_client_newname: "
|
|
||||||
"dns_message_gettempname failed: done");
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
isc_buffer_availableregion(dbuf, &r);
|
isc_buffer_availableregion(dbuf, &r);
|
||||||
isc_buffer_init(nbuf, r.base, r.length);
|
isc_buffer_init(nbuf, r.base, r.length);
|
||||||
dns_name_setbuffer(name, NULL);
|
dns_name_setbuffer(name, NULL);
|
||||||
|
@ -8352,15 +8352,8 @@ query_dns64(query_ctx_t *qctx) {
|
|||||||
isc_buffer_allocate(client->manager->mctx, &buffer,
|
isc_buffer_allocate(client->manager->mctx, &buffer,
|
||||||
view->dns64cnt * 16 *
|
view->dns64cnt * 16 *
|
||||||
dns_rdataset_count(qctx->rdataset));
|
dns_rdataset_count(qctx->rdataset));
|
||||||
result = dns_message_gettemprdataset(client->message, &dns64_rdataset);
|
dns_message_gettemprdataset(client->message, &dns64_rdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettemprdatalist(client->message, &dns64_rdatalist);
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
result = dns_message_gettemprdatalist(client->message,
|
|
||||||
&dns64_rdatalist);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_rdatalist_init(dns64_rdatalist);
|
dns_rdatalist_init(dns64_rdatalist);
|
||||||
dns64_rdatalist->rdclass = dns_rdataclass_in;
|
dns64_rdatalist->rdclass = dns_rdataclass_in;
|
||||||
@ -8406,11 +8399,7 @@ query_dns64(query_ctx_t *qctx) {
|
|||||||
isc_buffer_add(buffer, 16);
|
isc_buffer_add(buffer, 16);
|
||||||
isc_buffer_remainingregion(buffer, &r);
|
isc_buffer_remainingregion(buffer, &r);
|
||||||
isc_buffer_forward(buffer, 16);
|
isc_buffer_forward(buffer, 16);
|
||||||
result = dns_message_gettemprdata(client->message,
|
dns_message_gettemprdata(client->message, &dns64_rdata);
|
||||||
&dns64_rdata);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
dns_rdata_init(dns64_rdata);
|
dns_rdata_init(dns64_rdata);
|
||||||
dns_rdata_fromregion(dns64_rdata, dns_rdataclass_in,
|
dns_rdata_fromregion(dns64_rdata, dns_rdataclass_in,
|
||||||
dns_rdatatype_aaaa, &r);
|
dns_rdatatype_aaaa, &r);
|
||||||
@ -8531,14 +8520,8 @@ query_filter64(query_ctx_t *qctx) {
|
|||||||
|
|
||||||
isc_buffer_allocate(client->manager->mctx, &buffer,
|
isc_buffer_allocate(client->manager->mctx, &buffer,
|
||||||
16 * dns_rdataset_count(qctx->rdataset));
|
16 * dns_rdataset_count(qctx->rdataset));
|
||||||
result = dns_message_gettemprdataset(client->message, &myrdataset);
|
dns_message_gettemprdataset(client->message, &myrdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettemprdatalist(client->message, &myrdatalist);
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
result = dns_message_gettemprdatalist(client->message, &myrdatalist);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_rdatalist_init(myrdatalist);
|
dns_rdatalist_init(myrdatalist);
|
||||||
myrdatalist->rdclass = dns_rdataclass_in;
|
myrdatalist->rdclass = dns_rdataclass_in;
|
||||||
@ -8558,10 +8541,7 @@ query_filter64(query_ctx_t *qctx) {
|
|||||||
isc_buffer_putmem(buffer, rdata.data, rdata.length);
|
isc_buffer_putmem(buffer, rdata.data, rdata.length);
|
||||||
isc_buffer_remainingregion(buffer, &r);
|
isc_buffer_remainingregion(buffer, &r);
|
||||||
isc_buffer_forward(buffer, rdata.length);
|
isc_buffer_forward(buffer, rdata.length);
|
||||||
result = dns_message_gettemprdata(client->message, &myrdata);
|
dns_message_gettemprdata(client->message, &myrdata);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
dns_rdata_init(myrdata);
|
dns_rdata_init(myrdata);
|
||||||
dns_rdata_fromregion(myrdata, dns_rdataclass_in,
|
dns_rdata_fromregion(myrdata, dns_rdataclass_in,
|
||||||
dns_rdatatype_aaaa, &r);
|
dns_rdatatype_aaaa, &r);
|
||||||
@ -9885,10 +9865,7 @@ query_synthcnamewildcard(query_ctx_t *qctx, dns_rdataset_t *rdataset,
|
|||||||
* Reset qname to be the target name of the CNAME and restart
|
* Reset qname to be the target name of the CNAME and restart
|
||||||
* the query.
|
* the query.
|
||||||
*/
|
*/
|
||||||
result = dns_message_gettempname(qctx->client->message, &tname);
|
dns_message_gettempname(qctx->client->message, &tname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_rdataset_first(rdataset);
|
result = dns_rdataset_first(rdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -10510,10 +10487,7 @@ query_cname(query_ctx_t *qctx) {
|
|||||||
* Reset qname to be the target name of the CNAME and restart
|
* Reset qname to be the target name of the CNAME and restart
|
||||||
* the query.
|
* the query.
|
||||||
*/
|
*/
|
||||||
result = dns_message_gettempname(qctx->client->message, &tname);
|
dns_message_gettempname(qctx->client->message, &tname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (ns_query_done(qctx));
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_rdataset_first(trdataset);
|
result = dns_rdataset_first(trdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -10612,10 +10586,7 @@ query_dname(query_ctx_t *qctx) {
|
|||||||
* Get the target name of the DNAME.
|
* Get the target name of the DNAME.
|
||||||
*/
|
*/
|
||||||
tname = NULL;
|
tname = NULL;
|
||||||
result = dns_message_gettempname(qctx->client->message, &tname);
|
dns_message_gettempname(qctx->client->message, &tname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (ns_query_done(qctx));
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_rdataset_first(trdataset);
|
result = dns_rdataset_first(trdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -10720,35 +10691,16 @@ query_addcname(query_ctx_t *qctx, dns_trust_t trust, dns_ttl_t ttl) {
|
|||||||
dns_rdata_t *rdata = NULL;
|
dns_rdata_t *rdata = NULL;
|
||||||
isc_region_t r;
|
isc_region_t r;
|
||||||
dns_name_t *aname = NULL;
|
dns_name_t *aname = NULL;
|
||||||
isc_result_t result;
|
|
||||||
|
|
||||||
result = dns_message_gettempname(client->message, &aname);
|
dns_message_gettempname(client->message, &aname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
dns_name_copy(client->query.qname, aname);
|
dns_name_copy(client->query.qname, aname);
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(client->message, &rdatalist);
|
dns_message_gettemprdatalist(client->message, &rdatalist);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
dns_message_puttempname(client->message, &aname);
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_message_gettemprdata(client->message, &rdata);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(client->message, &rdataset);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
rdatalist->type = dns_rdatatype_cname;
|
rdatalist->type = dns_rdatatype_cname;
|
||||||
rdatalist->rdclass = client->message->rdclass;
|
rdatalist->rdclass = client->message->rdclass;
|
||||||
@ -10858,10 +10810,7 @@ query_addsoa(query_ctx_t *qctx, unsigned int override_ttl,
|
|||||||
/*
|
/*
|
||||||
* Get resources and make 'name' be the database origin.
|
* Get resources and make 'name' be the database origin.
|
||||||
*/
|
*/
|
||||||
result = dns_message_gettempname(client->message, &name);
|
dns_message_gettempname(client->message, &name);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We'll be releasing 'name' before returning, so it's safe to
|
* We'll be releasing 'name' before returning, so it's safe to
|
||||||
@ -10998,12 +10947,7 @@ query_addns(query_ctx_t *qctx) {
|
|||||||
/*
|
/*
|
||||||
* Get resources and make 'name' be the database origin.
|
* Get resources and make 'name' be the database origin.
|
||||||
*/
|
*/
|
||||||
result = dns_message_gettempname(client->message, &name);
|
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_name_clone(dns_db_origin(qctx->db), name);
|
dns_name_clone(dns_db_origin(qctx->db), name);
|
||||||
rdataset = ns_client_newrdataset(client);
|
rdataset = ns_client_newrdataset(client);
|
||||||
if (rdataset == NULL) {
|
if (rdataset == NULL) {
|
||||||
|
@ -614,14 +614,8 @@ attach_query_msg_to_client(ns_client_t *client, const char *qnamestr,
|
|||||||
/*
|
/*
|
||||||
* Allocate structures required to construct the query.
|
* Allocate structures required to construct the query.
|
||||||
*/
|
*/
|
||||||
result = dns_message_gettemprdataset(message, &qrdataset);
|
dns_message_gettemprdataset(message, &qrdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
dns_message_gettempname(message, &qname);
|
||||||
goto destroy_message;
|
|
||||||
}
|
|
||||||
result = dns_message_gettempname(message, &qname);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto put_rdataset;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert "qnamestr" to a DNS name, create a question rdataset of
|
* Convert "qnamestr" to a DNS name, create a question rdataset of
|
||||||
@ -669,7 +663,6 @@ attach_query_msg_to_client(ns_client_t *client, const char *qnamestr,
|
|||||||
|
|
||||||
put_name:
|
put_name:
|
||||||
dns_message_puttempname(message, &qname);
|
dns_message_puttempname(message, &qname);
|
||||||
put_rdataset:
|
|
||||||
dns_message_puttemprdataset(message, &qrdataset);
|
dns_message_puttemprdataset(message, &qrdataset);
|
||||||
destroy_message:
|
destroy_message:
|
||||||
dns_message_detach(&message);
|
dns_message_detach(&message);
|
||||||
|
@ -1386,18 +1386,12 @@ sendstream(xfrout_ctx_t *xfr) {
|
|||||||
isc_buffer_add(&xfr->buf, 12 + 4);
|
isc_buffer_add(&xfr->buf, 12 + 4);
|
||||||
|
|
||||||
qrdataset = NULL;
|
qrdataset = NULL;
|
||||||
result = dns_message_gettemprdataset(msg, &qrdataset);
|
dns_message_gettemprdataset(msg, &qrdataset);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
dns_rdataset_makequestion(qrdataset,
|
dns_rdataset_makequestion(qrdataset,
|
||||||
xfr->client->message->rdclass,
|
xfr->client->message->rdclass,
|
||||||
xfr->qtype);
|
xfr->qtype);
|
||||||
|
|
||||||
result = dns_message_gettempname(msg, &qname);
|
dns_message_gettempname(msg, &qname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
isc_buffer_availableregion(&xfr->buf, &r);
|
isc_buffer_availableregion(&xfr->buf, &r);
|
||||||
INSIST(r.length >= xfr->qname->length);
|
INSIST(r.length >= xfr->qname->length);
|
||||||
r.length = xfr->qname->length;
|
r.length = xfr->qname->length;
|
||||||
@ -1467,10 +1461,7 @@ sendstream(xfrout_ctx_t *xfr) {
|
|||||||
log_rr(name, rdata, ttl); /* XXX */
|
log_rr(name, rdata, ttl); /* XXX */
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dns_message_gettempname(msg, &msgname);
|
dns_message_gettempname(msg, &msgname);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
isc_buffer_availableregion(&xfr->buf, &r);
|
isc_buffer_availableregion(&xfr->buf, &r);
|
||||||
INSIST(r.length >= name->length);
|
INSIST(r.length >= name->length);
|
||||||
r.length = name->length;
|
r.length = name->length;
|
||||||
@ -1480,20 +1471,14 @@ sendstream(xfrout_ctx_t *xfr) {
|
|||||||
/* Reserve space for RR header. */
|
/* Reserve space for RR header. */
|
||||||
isc_buffer_add(&xfr->buf, 10);
|
isc_buffer_add(&xfr->buf, 10);
|
||||||
|
|
||||||
result = dns_message_gettemprdata(msg, &msgrdata);
|
dns_message_gettemprdata(msg, &msgrdata);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
isc_buffer_availableregion(&xfr->buf, &r);
|
isc_buffer_availableregion(&xfr->buf, &r);
|
||||||
r.length = rdata->length;
|
r.length = rdata->length;
|
||||||
isc_buffer_putmem(&xfr->buf, rdata->data, rdata->length);
|
isc_buffer_putmem(&xfr->buf, rdata->data, rdata->length);
|
||||||
dns_rdata_init(msgrdata);
|
dns_rdata_init(msgrdata);
|
||||||
dns_rdata_fromregion(msgrdata, rdata->rdclass, rdata->type, &r);
|
dns_rdata_fromregion(msgrdata, rdata->rdclass, rdata->type, &r);
|
||||||
|
|
||||||
result = dns_message_gettemprdatalist(msg, &msgrdl);
|
dns_message_gettemprdatalist(msg, &msgrdl);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
msgrdl->type = rdata->type;
|
msgrdl->type = rdata->type;
|
||||||
msgrdl->rdclass = rdata->rdclass;
|
msgrdl->rdclass = rdata->rdclass;
|
||||||
msgrdl->ttl = ttl;
|
msgrdl->ttl = ttl;
|
||||||
@ -1505,10 +1490,7 @@ sendstream(xfrout_ctx_t *xfr) {
|
|||||||
}
|
}
|
||||||
ISC_LIST_APPEND(msgrdl->rdata, msgrdata, link);
|
ISC_LIST_APPEND(msgrdl->rdata, msgrdata, link);
|
||||||
|
|
||||||
result = dns_message_gettemprdataset(msg, &msgrds);
|
dns_message_gettemprdataset(msg, &msgrds);
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto failure;
|
|
||||||
}
|
|
||||||
result = dns_rdatalist_tordataset(msgrdl, msgrds);
|
result = dns_rdatalist_tordataset(msgrdl, msgrds);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user