]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2283. [bug] TSIG keys were not attaching to the memory
authorMark Andrews <marka@isc.org>
Wed, 2 Jan 2008 04:24:59 +0000 (04:24 +0000)
committerMark Andrews <marka@isc.org>
Wed, 2 Jan 2008 04:24:59 +0000 (04:24 +0000)
                        context.  TSIG keys should use the rings
                        memory context rather than the clients memory
                        context. [RT #17377]

CHANGES
lib/dns/tkey.c
lib/dns/tsig.c

diff --git a/CHANGES b/CHANGES
index 8be16b9b915980c50552f3119d9bfcf0d8f653a4..3cad1cb6ff61094153d5c63100c3cf4a72280700 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+2283.  [bug]           TSIG keys were not attaching to the memory
+                       context.  TSIG keys should use the rings
+                       memory context rather than the clients memory
+                       context. [RT #17377]
+
 2282.  [bug]           Acl code fixups. [RT #17346] [RT #17374]
 
 2281.  [bug]           Attempts to use undefined acls were not being logged.
index fdc879b6cac5d5585e455a5847a8e2d418cfc5e2..2b17e29a4a7575e769498133cdd08210c9e4b728 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id: tkey.c,v 1.86 2007/06/19 23:47:16 tbox Exp $
+ * $Id: tkey.c,v 1.87 2008/01/02 04:24:59 marka Exp $
  */
 /*! \file */
 #include <config.h>
@@ -393,7 +393,7 @@ process_dhtkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name,
                                  isc_buffer_base(&secret),
                                  isc_buffer_usedlength(&secret),
                                  ISC_TRUE, signer, tkeyin->inception,
-                                 tkeyin->expire, msg->mctx, ring, NULL));
+                                 tkeyin->expire, ring->mctx, ring, NULL));
 
        /* This key is good for a long time */
        tkeyout->inception = tkeyin->inception;
@@ -485,7 +485,7 @@ process_gsstkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name,
                                                 dns_fixedname_name(&principal),
                                                 tkeyin->inception,
                                                 tkeyin->expire,
-                                                msg->mctx, ring, NULL));
+                                                ring->mctx, ring, NULL));
        }
 
        isc_stdtime_get(&now);
@@ -1270,7 +1270,7 @@ dns_tkey_processgssresponse(dns_message_t *qmsg, dns_message_t *rmsg,
        RETERR(dns_tsigkey_createfromkey(tkeyname, DNS_TSIG_GSSAPI_NAME,
                                         dstkey, ISC_FALSE, NULL,
                                         rtkey.inception, rtkey.expire,
-                                        rmsg->mctx, ring, outkey));
+                                        ring->mctx, ring, outkey));
 
        dns_rdata_freestruct(&rtkey);
        return (result);
@@ -1405,7 +1405,7 @@ dns_tkey_gssnegotiate(dns_message_t *qmsg, dns_message_t *rmsg,
                                          : DNS_TSIG_GSSAPI_NAME),
                                         dstkey, ISC_TRUE, NULL,
                                         rtkey.inception, rtkey.expire,
-                                        rmsg->mctx, ring, outkey));
+                                        ring->mctx, ring, outkey));
 
        dns_rdata_freestruct(&rtkey);
        return (result);
index 5ab20a348c0f22a80f5728e8bd4e5a11288572ea..41cd69b951535db19ceb6407f96d2574cc15d191 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id: tsig.c,v 1.130 2007/09/24 17:18:25 each Exp $
+ * $Id: tsig.c,v 1.131 2008/01/02 04:24:59 marka Exp $
  */
 /*! \file */
 #include <config.h>
@@ -341,7 +341,8 @@ dns_tsigkey_createfromkey(dns_name_t *name, dns_name_t *algorithm,
        tkey->generated = generated;
        tkey->inception = inception;
        tkey->expire = expire;
-       tkey->mctx = mctx;
+       tkey->mctx = NULL;
+       isc_mem_attach(mctx, &tkey->mctx);
 
        tkey->magic = TSIG_MAGIC;
 
@@ -603,7 +604,7 @@ tsigkey_free(dns_tsigkey_t *key) {
                isc_mem_put(key->mctx, key->creator, sizeof(dns_name_t));
        }
        isc_refcount_destroy(&key->refs);
-       isc_mem_put(key->mctx, key, sizeof(dns_tsigkey_t));
+       isc_mem_putanddetach(&key->mctx, key, sizeof(dns_tsigkey_t));
 }
 
 void
@@ -1525,8 +1526,9 @@ dns_tsigkeyring_create(isc_mem_t *mctx, dns_tsig_keyring_t **ringp) {
                return (result);
        }
 
-       ring->mctx = mctx;
        ring->writecount = 0;
+       ring->mctx = NULL;
+       isc_mem_attach(mctx, &ring->mctx);
 
        *ringp = ring;
        return (ISC_R_SUCCESS);
@@ -1544,5 +1546,5 @@ dns_tsigkeyring_destroy(dns_tsig_keyring_t **ringp) {
 
        dns_rbt_destroy(&ring->keys);
        isc_rwlock_destroy(&ring->lock);
-       isc_mem_put(ring->mctx, ring, sizeof(dns_tsig_keyring_t));
+       isc_mem_putanddetach(&ring->mctx, ring, sizeof(dns_tsig_keyring_t));
 }