2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

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]
This commit is contained in:
Mark Andrews
2008-01-02 04:24:59 +00:00
parent 114c14f8ad
commit dc19dcbc23
3 changed files with 17 additions and 10 deletions

View 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));
}