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

2696. [bug] named failed to successfully process some valid

acl constructs. [RT #20308]
This commit is contained in:
Mark Andrews
2009-10-01 04:06:37 +00:00
parent bafa76b324
commit eb95d2e917
2 changed files with 20 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
2696. [bug] named failed to successfully process some valid
acl constructs. [RT #20308]
2695. [func] DHCP/DDNS - update fdwatch code for use by 2695. [func] DHCP/DDNS - update fdwatch code for use by
DHCP. Modify the api to isc_sockfdwatch_t (the DHCP. Modify the api to isc_sockfdwatch_t (the
callback funciton for isc_socket_fdwatchcreate) callback funciton for isc_socket_fdwatchcreate)

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: aclconf.c,v 1.25 2009/09/01 00:22:28 jinmei Exp $ */ /* $Id: aclconf.c,v 1.26 2009/10/01 04:06:37 marka Exp $ */
#include <config.h> #include <config.h>
@@ -168,26 +168,36 @@ convert_keyname(const cfg_obj_t *keyobj, isc_log_t *lctx, isc_mem_t *mctx,
* parent. * parent.
*/ */
static int static int
count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx) count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx,
isc_boolean_t *has_negative)
{ {
const cfg_listelt_t *elt; const cfg_listelt_t *elt;
const cfg_obj_t *cacl = NULL; const cfg_obj_t *cacl = NULL;
isc_result_t result; isc_result_t result;
int n = 0; int n = 0;
if (has_negative != NULL)
*has_negative = ISC_FALSE;
for (elt = cfg_list_first(caml); for (elt = cfg_list_first(caml);
elt != NULL; elt != NULL;
elt = cfg_list_next(elt)) { elt = cfg_list_next(elt)) {
const cfg_obj_t *ce = cfg_listelt_value(elt); const cfg_obj_t *ce = cfg_listelt_value(elt);
/* negated element; just get the value. */ /* negated element; just get the value. */
if (cfg_obj_istuple(ce)) if (cfg_obj_istuple(ce)) {
ce = cfg_tuple_get(ce, "value"); ce = cfg_tuple_get(ce, "value");
if (has_negative != NULL)
*has_negative = ISC_TRUE;
}
if (cfg_obj_istype(ce, &cfg_type_keyref)) { if (cfg_obj_istype(ce, &cfg_type_keyref)) {
n++; n++;
} else if (cfg_obj_islist(ce)) { } else if (cfg_obj_islist(ce)) {
n += count_acl_elements(ce, cctx); isc_boolean_t negative;
n += count_acl_elements(ce, cctx, &negative);
if (negative)
n++;
} else if (cfg_obj_isstring(ce)) { } else if (cfg_obj_isstring(ce)) {
const char *name = cfg_obj_asstring(ce); const char *name = cfg_obj_asstring(ce);
if (strcasecmp(name, "localhost") == 0 || if (strcasecmp(name, "localhost") == 0 ||
@@ -197,7 +207,8 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx)
strcasecmp(name, "none") != 0) { strcasecmp(name, "none") != 0) {
result = get_acl_def(cctx, name, &cacl); result = get_acl_def(cctx, name, &cacl);
if (result == ISC_R_SUCCESS) if (result == ISC_R_SUCCESS)
n += count_acl_elements(cacl, cctx) + 1; n += count_acl_elements(cacl, cctx,
NULL) + 1;
} }
} }
} }
@@ -246,7 +257,7 @@ cfg_acl_fromconfig(const cfg_obj_t *caml,
int nelem; int nelem;
if (nest_level == 0) if (nest_level == 0)
nelem = count_acl_elements(caml, cctx); nelem = count_acl_elements(caml, cctx, NULL);
else else
nelem = cfg_list_length(caml, ISC_FALSE); nelem = cfg_list_length(caml, ISC_FALSE);