]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2403. [bug] TSIG context leak. [RT #18341]
authorMark Andrews <marka@isc.org>
Mon, 28 Jul 2008 08:39:52 +0000 (08:39 +0000)
committerMark Andrews <marka@isc.org>
Mon, 28 Jul 2008 08:39:52 +0000 (08:39 +0000)
CHANGES
lib/dns/message.c
lib/dns/xfrin.c

diff --git a/CHANGES b/CHANGES
index b6c81b3d6560422671d47f4205851d99f45d4558..43c1ad676f8d36ecc4cd37bb7ec6abae2fb49130 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+2403.  [bug]           TSIG context leak. [RT #18341]
+
 2402.  [port]          Support Solaris 2.11 and over. [RT #18362]
 
 2401.  [bug]           Expect to get E[MN]FILE errno internal_accept()
index 48e8f6f9df1ae2ac6ec6234fb4eaf9d5de57cdc9..d91bccc66dc2ffeecadb71b16f2b73ba91fcef92 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: message.c,v 1.243 2008/04/03 10:45:35 marka Exp $ */
+/* $Id: message.c,v 1.244 2008/07/28 08:39:52 marka Exp $ */
 
 /*! \file */
 
@@ -622,6 +622,9 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) {
                msg->tsigkey = NULL;
        }
 
+       if (msg->tsigctx != NULL)
+               dst_context_destroy(&msg->tsigctx);
+
        if (msg->query.base != NULL) {
                if (msg->free_query != 0)
                        isc_mem_put(msg->mctx, msg->query.base,
index 3b2a03c16f5b8f918046b4f9e38a29efda255411..b3586d6f6ba183d0656a63d311bf743e09bf38b7 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: xfrin.c,v 1.160 2008/07/23 23:27:54 marka Exp $ */
+/* $Id: xfrin.c,v 1.161 2008/07/28 08:39:52 marka Exp $ */
 
 /*! \file */
 
@@ -1075,6 +1075,8 @@ xfrin_send_request(dns_xfrin_ctx_t *xfr) {
        xfr->nbytes = 0;
        isc_time_now(&xfr->start);
        msg->id = xfr->id;
+       if (xfr->tsigctx != NULL)
+               dst_context_destroy(&xfr->tsigctx);
 
        CHECK(render(msg, xfr->mctx, &xfr->qbuffer));
 
@@ -1210,7 +1212,10 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
 
        CHECK(dns_message_settsigkey(msg, xfr->tsigkey));
        CHECK(dns_message_setquerytsig(msg, xfr->lasttsig));
+
        msg->tsigctx = xfr->tsigctx;
+       xfr->tsigctx = NULL;
+       
        if (xfr->nmsg > 0)
                msg->tcp_continuation = 1;
 
@@ -1328,9 +1333,11 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
        xfr->nbytes += tcpmsg->buffer.used;
 
        /*
-        * Copy the context back.
+        * Take the context back.
         */
+       INSIST(xfr->tsigctx == NULL);
        xfr->tsigctx = msg->tsigctx;
+       msg->tsigctx = NULL;
 
        dns_message_destroy(&msg);
 
@@ -1444,6 +1451,9 @@ maybe_free(dns_xfrin_ctx_t *xfr) {
        if (xfr->tcpmsg_valid)
                dns_tcpmsg_invalidate(&xfr->tcpmsg);
 
+       if (xfr->tsigctx != NULL)
+               dst_context_destroy(&xfr->tsigctx);
+
        if ((xfr->name.attributes & DNS_NAMEATTR_DYNAMIC) != 0)
                dns_name_free(&xfr->name, xfr->mctx);