mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +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:
4
CHANGES
4
CHANGES
@@ -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]
|
732. [bug] Glue with 0 TTL could also cause SERVFAIL. [RT #828]
|
||||||
|
|
||||||
731. [bug] Certain zone errors could cause named-checkzone to
|
731. [bug] Certain zone errors could cause named-checkzone to
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ dns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) {
|
|||||||
return (ISC_R_NOMEMORY);
|
return (ISC_R_NOMEMORY);
|
||||||
acl->mctx = mctx;
|
acl->mctx = mctx;
|
||||||
acl->name = NULL;
|
acl->name = NULL;
|
||||||
acl->refcount = 1;
|
isc_refcount_init(&acl->refcount, 1);
|
||||||
acl->elements = NULL;
|
acl->elements = NULL;
|
||||||
acl->alloc = 0;
|
acl->alloc = 0;
|
||||||
acl->length = 0;
|
acl->length = 0;
|
||||||
@@ -235,8 +235,7 @@ dns_aclelement_match(isc_netaddr_t *reqaddr,
|
|||||||
void
|
void
|
||||||
dns_acl_attach(dns_acl_t *source, dns_acl_t **target) {
|
dns_acl_attach(dns_acl_t *source, dns_acl_t **target) {
|
||||||
REQUIRE(DNS_ACL_VALID(source));
|
REQUIRE(DNS_ACL_VALID(source));
|
||||||
INSIST(source->refcount > 0);
|
isc_refcount_increment(&source->refcount, NULL);
|
||||||
source->refcount++;
|
|
||||||
*target = source;
|
*target = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,6 +260,7 @@ destroy(dns_acl_t *dacl) {
|
|||||||
dacl->alloc * sizeof(dns_aclelement_t));
|
dacl->alloc * sizeof(dns_aclelement_t));
|
||||||
if (dacl->name != NULL)
|
if (dacl->name != NULL)
|
||||||
isc_mem_free(dacl->mctx, dacl->name);
|
isc_mem_free(dacl->mctx, dacl->name);
|
||||||
|
isc_refcount_destroy(&dacl->refcount);
|
||||||
dacl->magic = 0;
|
dacl->magic = 0;
|
||||||
isc_mem_put(dacl->mctx, dacl, sizeof(*dacl));
|
isc_mem_put(dacl->mctx, dacl, sizeof(*dacl));
|
||||||
}
|
}
|
||||||
@@ -268,10 +268,10 @@ destroy(dns_acl_t *dacl) {
|
|||||||
void
|
void
|
||||||
dns_acl_detach(dns_acl_t **aclp) {
|
dns_acl_detach(dns_acl_t **aclp) {
|
||||||
dns_acl_t *acl = *aclp;
|
dns_acl_t *acl = *aclp;
|
||||||
|
unsigned int refs;
|
||||||
REQUIRE(DNS_ACL_VALID(acl));
|
REQUIRE(DNS_ACL_VALID(acl));
|
||||||
INSIST(acl->refcount > 0);
|
isc_refcount_decrement(&acl->refcount, &refs);
|
||||||
acl->refcount--;
|
if (refs == 0)
|
||||||
if (acl->refcount == 0)
|
|
||||||
destroy(acl);
|
destroy(acl);
|
||||||
*aclp = NULL;
|
*aclp = NULL;
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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
|
#ifndef DNS_ACL_H
|
||||||
#define DNS_ACL_H 1
|
#define DNS_ACL_H 1
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/magic.h>
|
#include <isc/magic.h>
|
||||||
#include <isc/netaddr.h>
|
#include <isc/netaddr.h>
|
||||||
|
#include <isc/refcount.h>
|
||||||
|
|
||||||
#include <dns/name.h>
|
#include <dns/name.h>
|
||||||
#include <dns/types.h>
|
#include <dns/types.h>
|
||||||
@@ -72,7 +73,7 @@ struct dns_aclelement {
|
|||||||
struct dns_acl {
|
struct dns_acl {
|
||||||
isc_uint32_t magic;
|
isc_uint32_t magic;
|
||||||
isc_mem_t *mctx;
|
isc_mem_t *mctx;
|
||||||
unsigned int refcount;
|
isc_refcount_t refcount;
|
||||||
dns_aclelement_t *elements;
|
dns_aclelement_t *elements;
|
||||||
unsigned int alloc; /* Elements allocated */
|
unsigned int alloc; /* Elements allocated */
|
||||||
unsigned int length; /* Elements initialized */
|
unsigned int length; /* Elements initialized */
|
||||||
|
Reference in New Issue
Block a user