Commit 5e9607e3 authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

pullup to 9.0:

 661.   [bug]           Certain UDP IXFR requests caused an assertion failure
                        (mpctx->allocated == 0). [RT #355, #394, #623]
parent 16c708db
661. [bug] Certain UDP IXFR requests caused an assertion failure
(mpctx->allocated == 0). [RT #355, #394, #623]
589. [bug] The server could deadlock if a zone was updated
while being transferred out.
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: xfrout.c,v 1.68.2.4 2000/12/04 18:59:40 bwelling Exp $ */
/* $Id: xfrout.c,v 1.68.2.5 2001/01/08 20:11:40 gson Exp $ */
#include <config.h>
......@@ -1233,7 +1233,8 @@ failure:
*/
static void
sendstream(xfrout_ctx_t *xfr) {
dns_message_t *msg = NULL;
dns_message_t *tcpmsg = NULL;
dns_message_t *msg = NULL; /* Client message if UDP, tcpmsg if TCP */
isc_result_t result;
isc_region_t used;
isc_region_t region;
......@@ -1244,15 +1245,25 @@ sendstream(xfrout_ctx_t *xfr) {
isc_buffer_clear(&xfr->txlenbuf);
isc_buffer_clear(&xfr->txbuf);
if ((xfr->client->attributes & NS_CLIENTATTR_TCP) == 0) {
/*
* Build a response dns_message_t, temporarily storing the raw,
* uncompressed owner names and RR data contiguously in xfr->buf.
* We know that if the uncompressed data fits in xfr->buf,
* the compressed data will surely fit in a TCP message.
* In the UDP case, we put the response data directly into
* the client message.
*/
msg = xfr->client->message;
CHECK(dns_message_reply(msg, ISC_TRUE));
} else {
/*
* TCP. Build a response dns_message_t, temporarily storing
* the raw, uncompressed owner names and RR data contiguously
* in xfr->buf. We know that if the uncompressed data fits
* in xfr->buf, the compressed data will surely fit in a TCP
* message.
*/
msg = NULL;
CHECK(dns_message_create(xfr->mctx, DNS_MESSAGE_INTENTRENDER, &msg));
CHECK(dns_message_create(xfr->mctx,
DNS_MESSAGE_INTENTRENDER, &tcpmsg));
msg = tcpmsg;
msg->id = xfr->id;
msg->rcode = dns_rcode_noerror;
......@@ -1266,8 +1277,8 @@ sendstream(xfrout_ctx_t *xfr) {
/*
* Include a question section in the first message only.
* BIND 8.2.1 will not recognize an IXFR if it does not have a
* question section.
* BIND 8.2.1 will not recognize an IXFR if it does not
* have a question section.
*/
if (xfr->nmsg == 0) {
dns_name_t *qname = NULL;
......@@ -1305,6 +1316,7 @@ sendstream(xfrout_ctx_t *xfr) {
}
else
msg->tcp_continuation = 1;
}
/*
* Try to fit in as many RRs as possible, unless "one-answer"
......@@ -1420,16 +1432,11 @@ sendstream(xfrout_ctx_t *xfr) {
xfr));
xfr->sends++;
} else {
xfrout_log(xfr, ISC_LOG_DEBUG(8),
"sending IXFR UDP response");
/* XXX kludge */
dns_message_destroy(&xfr->client->message);
xfr->client->message = msg;
msg = NULL;
xfrout_log(xfr, ISC_LOG_DEBUG(8), "sending IXFR UDP response");
ns_client_send(xfr->client);
xfr->stream->methods->pause(xfr->stream);
xfrout_ctx_destroy(&xfr);
result = ISC_R_SUCCESS;
goto done;
return;
}
/* Advance lasttsig to be the last TSIG generated */
......@@ -1441,11 +1448,9 @@ sendstream(xfrout_ctx_t *xfr) {
/*
* XXXRTH need to cleanup qname and qrdataset...
*/
if (msg != NULL) {
dns_message_destroy(&msg);
}
if (tcpmsg != NULL)
dns_message_destroy(&tcpmsg);
done:
/*
* Make sure to release any locks held by database
* iterators before returning from the event handler.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment