From a4925f8d787290c6365196ad2933a896fbfc285d Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Fri, 11 Aug 2000 02:13:02 +0000 Subject: [PATCH] pullup: 386. [bug] Missing strdup() of ACL name caused random ACL matching failures [RT #228]. --- CHANGES | 2 ++ lib/dns/acl.c | 4 +++- lib/dns/aclconf.c | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index c460aecf7d..0a65dc25b9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ + 386. [bug] Missing strdup() of ACL name caused random + ACL matching failures [RT #228]. --- 9.0.0rc2 released --- diff --git a/lib/dns/acl.c b/lib/dns/acl.c index 8da756b4b6..be13a97964 100644 --- a/lib/dns/acl.c +++ b/lib/dns/acl.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: acl.c,v 1.11 2000/06/22 21:54:16 tale Exp $ */ +/* $Id: acl.c,v 1.11.2.1 2000/08/11 02:13:01 bwelling Exp $ */ #include @@ -242,6 +242,8 @@ destroy(dns_acl_t *dacl) { if (dacl->elements != NULL) isc_mem_put(dacl->mctx, dacl->elements, dacl->alloc * sizeof(dns_aclelement_t)); + if (dacl->name != NULL) + isc_mem_free(dacl->mctx, dacl->name); dacl->magic = 0; isc_mem_put(dacl->mctx, dacl, sizeof(*dacl)); } diff --git a/lib/dns/aclconf.c b/lib/dns/aclconf.c index 8c60b59e00..6c8d616351 100644 --- a/lib/dns/aclconf.c +++ b/lib/dns/aclconf.c @@ -15,10 +15,11 @@ * SOFTWARE. */ -/* $Id: aclconf.c,v 1.18 2000/06/22 21:54:17 tale Exp $ */ +/* $Id: aclconf.c,v 1.18.2.1 2000/08/11 02:13:02 bwelling Exp $ */ #include +#include #include /* Required for HP/UX (and others?) */ #include @@ -61,7 +62,7 @@ convert_named_acl(char *aclname, dns_c_ctx_t *cctx, { if (strcmp(aclname, dacl->name) == 0) { dns_acl_attach(dacl, target); - return ISC_R_SUCCESS; + return (ISC_R_SUCCESS); } } /* Not yet converted. Convert now. */ @@ -75,7 +76,9 @@ convert_named_acl(char *aclname, dns_c_ctx_t *cctx, result = dns_acl_fromconfig(cacl->ipml, cctx, ctx, mctx, &dacl); if (result != ISC_R_SUCCESS) return (result); - dacl->name = aclname; + dacl->name = isc_mem_strdup(dacl->mctx, aclname); + if (dacl->name == NULL) + return (ISC_R_NOMEMORY); ISC_LIST_APPEND(ctx->named_acl_cache, dacl, nextincache); dns_acl_attach(dacl, target); return (ISC_R_SUCCESS);