* 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>
* parent.
*/
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_obj_t *cacl = NULL;
isc_result_t result;
int n = 0;
+ if (has_negative != NULL)
+ *has_negative = ISC_FALSE;
+
for (elt = cfg_list_first(caml);
elt != NULL;
elt = cfg_list_next(elt)) {
const cfg_obj_t *ce = cfg_listelt_value(elt);
/* negated element; just get the value. */
- if (cfg_obj_istuple(ce))
+ if (cfg_obj_istuple(ce)) {
ce = cfg_tuple_get(ce, "value");
+ if (has_negative != NULL)
+ *has_negative = ISC_TRUE;
+ }
if (cfg_obj_istype(ce, &cfg_type_keyref)) {
n++;
} 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)) {
const char *name = cfg_obj_asstring(ce);
if (strcasecmp(name, "localhost") == 0 ||
strcasecmp(name, "none") != 0) {
result = get_acl_def(cctx, name, &cacl);
if (result == ISC_R_SUCCESS)
- n += count_acl_elements(cacl, cctx) + 1;
+ n += count_acl_elements(cacl, cctx,
+ NULL) + 1;
}
}
}
int nelem;
if (nest_level == 0)
- nelem = count_acl_elements(caml, cctx);
+ nelem = count_acl_elements(caml, cctx, NULL);
else
nelem = cfg_list_length(caml, ISC_FALSE);