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

733. [bug] Reference counts of dns_acl_t objects need to be

locked but were not. [RT #801]
This commit is contained in:
Andreas Gustafsson 2001-02-08 23:30:32 +00:00
parent 22457624d3
commit aa23a35d81
3 changed files with 14 additions and 9 deletions

View File

@ -1,3 +1,7 @@
733. [bug] Reference counts of dns_acl_t objects need to be
locked but were not. [RT #801]
732. [bug] Glue with 0 TTL could also cause SERVFAIL. [RT #828]
731. [bug] Certain zone errors could cause named-checkzone to

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: acl.c,v 1.20 2001/01/17 17:44:49 gson Exp $ */
/* $Id: acl.c,v 1.21 2001/02/08 23:30:31 gson Exp $ */
#include <config.h>
@ -41,7 +41,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) {
return (ISC_R_NOMEMORY);
acl->mctx = mctx;
acl->name = NULL;
acl->refcount = 1;
isc_refcount_init(&acl->refcount, 1);
acl->elements = NULL;
acl->alloc = 0;
acl->length = 0;
@ -235,8 +235,7 @@ dns_aclelement_match(isc_netaddr_t *reqaddr,
void
dns_acl_attach(dns_acl_t *source, dns_acl_t **target) {
REQUIRE(DNS_ACL_VALID(source));
INSIST(source->refcount > 0);
source->refcount++;
isc_refcount_increment(&source->refcount, NULL);
*target = source;
}
@ -261,6 +260,7 @@ destroy(dns_acl_t *dacl) {
dacl->alloc * sizeof(dns_aclelement_t));
if (dacl->name != NULL)
isc_mem_free(dacl->mctx, dacl->name);
isc_refcount_destroy(&dacl->refcount);
dacl->magic = 0;
isc_mem_put(dacl->mctx, dacl, sizeof(*dacl));
}
@ -268,10 +268,10 @@ destroy(dns_acl_t *dacl) {
void
dns_acl_detach(dns_acl_t **aclp) {
dns_acl_t *acl = *aclp;
unsigned int refs;
REQUIRE(DNS_ACL_VALID(acl));
INSIST(acl->refcount > 0);
acl->refcount--;
if (acl->refcount == 0)
isc_refcount_decrement(&acl->refcount, &refs);
if (refs == 0)
destroy(acl);
*aclp = NULL;
}

View File

@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: acl.h,v 1.17 2001/01/09 21:52:15 bwelling Exp $ */
/* $Id: acl.h,v 1.18 2001/02/08 23:30:32 gson Exp $ */
#ifndef DNS_ACL_H
#define DNS_ACL_H 1
@ -35,6 +35,7 @@
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/netaddr.h>
#include <isc/refcount.h>
#include <dns/name.h>
#include <dns/types.h>
@ -72,7 +73,7 @@ struct dns_aclelement {
struct dns_acl {
isc_uint32_t magic;
isc_mem_t *mctx;
unsigned int refcount;
isc_refcount_t refcount;
dns_aclelement_t *elements;
unsigned int alloc; /* Elements allocated */
unsigned int length; /* Elements initialized */