2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +00:00

changes to the rdata_tostruct api had broken tsig/tkey

This commit is contained in:
Brian Wellington 2000-05-19 22:11:20 +00:00
parent f5eb48652c
commit c610d78e67
2 changed files with 30 additions and 5 deletions

View File

@ -502,14 +502,35 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) {
dns_compress_invalidate(&msg->cctx); dns_compress_invalidate(&msg->cctx);
if (msg->tsig != NULL) { if (msg->tsig != NULL) {
dns_rdata_freestruct(msg->tsig); if (msg->from_to_wire == DNS_MESSAGE_INTENTPARSE)
dns_rdata_freestruct(msg->tsig);
else {
if (msg->tsig->signature != NULL)
isc_mem_put(msg->mctx, msg->tsig->signature,
msg->tsig->siglen);
if (msg->tsig->other != NULL)
isc_mem_put(msg->mctx, msg->tsig->other,
msg->tsig->otherlen);
dns_name_free(&msg->tsig->algorithm, msg->mctx);
}
isc_mem_put(msg->mctx, msg->tsig, isc_mem_put(msg->mctx, msg->tsig,
sizeof(dns_rdata_any_tsig_t)); sizeof(dns_rdata_any_tsig_t));
msg->tsig = NULL; msg->tsig = NULL;
} }
if (msg->querytsig != NULL) { if (msg->querytsig != NULL) {
dns_rdata_freestruct(msg->querytsig); if (msg->from_to_wire != DNS_MESSAGE_INTENTPARSE)
dns_rdata_freestruct(msg->querytsig);
else {
if (msg->querytsig->signature != NULL)
isc_mem_put(msg->mctx,
msg->querytsig->signature,
msg->querytsig->siglen);
if (msg->querytsig->other != NULL)
isc_mem_put(msg->mctx, msg->querytsig->other,
msg->querytsig->otherlen);
dns_name_free(&msg->querytsig->algorithm, msg->mctx);
}
isc_mem_put(msg->mctx, msg->querytsig, isc_mem_put(msg->mctx, msg->querytsig,
sizeof(dns_rdata_any_tsig_t)); sizeof(dns_rdata_any_tsig_t));
msg->querytsig = NULL; msg->querytsig = NULL;
@ -659,8 +680,8 @@ dns_message_reset(dns_message_t *msg, unsigned int intent) {
REQUIRE(intent == DNS_MESSAGE_INTENTPARSE REQUIRE(intent == DNS_MESSAGE_INTENTPARSE
|| intent == DNS_MESSAGE_INTENTRENDER); || intent == DNS_MESSAGE_INTENTRENDER);
msg->from_to_wire = intent;
msgreset(msg, ISC_FALSE); msgreset(msg, ISC_FALSE);
msg->from_to_wire = intent;
} }
void void

View File

@ -16,7 +16,7 @@
*/ */
/* /*
* $Id: tkey.c,v 1.36 2000/05/19 00:20:52 bwelling Exp $ * $Id: tkey.c,v 1.37 2000/05/19 22:11:20 bwelling Exp $
* Principal Author: Brian Wellington * Principal Author: Brian Wellington
*/ */
@ -611,7 +611,11 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkey_ctx_t *tctx,
RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 128)); RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 128));
result = dns_rdata_fromstruct(rdata, tkeyout.common.rdclass, result = dns_rdata_fromstruct(rdata, tkeyout.common.rdclass,
tkeyout.common.rdtype, &tkeyout, dynbuf); tkeyout.common.rdtype, &tkeyout, dynbuf);
dns_rdata_freestruct(&tkeyout); dns_name_free(&tkeyout.algorithm, msg->mctx);
if (tkeyout.key != NULL)
isc_mem_put(msg->mctx, tkeyout.key, tkeyout.keylen);
if (tkeyout.other != NULL)
isc_mem_put(msg->mctx, tkeyout.other, tkeyout.otherlen);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto failure; goto failure;