acl.c revision ec5347e2c775f027573ce5648b910361aa926c01
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
53d399c20374a99bd95db1f9b5b93980cbf6a984Christian Maeder * Copyright (C) 1999-2002 Internet Software Consortium.
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski * Permission to use, copy, modify, and/or distribute this software for any
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski * purpose with or without fee is hereby granted, provided that the above
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski * copyright notice and this permission notice appear in all copies.
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
2b4130336e941b7d01c78a6da55449a4c6eca609Till Mossakowski * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
59d823de481014f68b8b024474bffac150b56e1eWiebke Herding * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
cc6df32dd55910aac7de12b30cc5049d96b8f770Wiebke Herding * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
53d399c20374a99bd95db1f9b5b93980cbf6a984Christian Maeder * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder * PERFORMANCE OF THIS SOFTWARE.
e4e1509ff358e739fddf1483ad39467e0e1becc2Christian Maeder/* $Id: acl.c,v 1.31 2007/06/18 23:47:40 tbox Exp $ */
856bdbffc895793cc5739dbb862323944cb76fdbChristian Maederdns_acl_create(isc_mem_t *mctx, int n, dns_acl_t **target) {
856bdbffc895793cc5739dbb862323944cb76fdbChristian Maeder * Work around silly limitation of isc_mem_get().
d297778800daa7ceba73ad9b19884c883487dee7Christian Maeder result = isc_refcount_init(&acl->refcount, 1);
b1f52a36d45c5031c462291e263cec114975add1Wiebke Herding * Must set magic early because we use dns_acl_detach() to clean up.
50dce6b011347f92377adb8bbabaeeb80975e86dChristian Maeder acl->elements = isc_mem_get(mctx, n * sizeof(dns_aclelement_t));
414ffa281d82f05a2d742c702f8e06b0cb05b229Christian Maeder memset(acl->elements, 0, n * sizeof(dns_aclelement_t));
b645cf3dc1e449038ed291bbd11fcc6e02b2fc7fChristian Maederdns_acl_appendelement(dns_acl_t *acl, const dns_aclelement_t *elt) {
310532f8a7a1a1f1b6c25c67b7c340abc0889335Christian Maeder * Resize the ACL.
return (ISC_R_SUCCESS);
static isc_result_t
return (result);
return (result);
int *match,
return (ISC_R_SUCCESS);
*match = 0;
return (ISC_R_SUCCESS);
*matchelt = e;
return (ISC_R_SUCCESS);
return (ISC_R_NOTFOUND);
const dns_aclelement_t *e,
int indirectmatch;
switch (e->type) {
goto matched;
goto matched;
env,
if (indirectmatch > 0)
goto matchelt_set;
case dns_aclelementtype_any:
*matchelt = e;
return (ISC_TRUE);
goto nested;
goto nested;
INSIST(0);
return (ISC_FALSE);
unsigned int refs;
if (refs == 0)
return (ISC_FALSE);
return (ISC_FALSE);
case dns_aclelementtype_any:
return (ISC_TRUE);
INSIST(0);
return (ISC_FALSE);
return (ISC_TRUE);
return (ISC_FALSE);
for (i = 0; i < a->length; i++) {
&b->elements[i]))
return (ISC_FALSE);
return (ISC_TRUE);
static isc_boolean_t
case AF_INET:
return (ISC_TRUE);
case AF_INET6:
return (ISC_TRUE);
return (ISC_FALSE);
for (i = 0; i < a->length; i++) {
if (e->negative)
switch (e->type) {
return (ISC_TRUE);
return (ISC_TRUE);
case dns_aclelementtype_any:
return (ISC_TRUE);
INSIST(0);
return (ISC_TRUE);
return (ISC_FALSE);
goto cleanup_nothing;
goto cleanup_localhost;
return (ISC_R_SUCCESS);
return (result);