aclconf.c revision ed019cabc1cc75d4412010c331876e4ae5080a4d
bd911976d51f102751848568ccf56592fd5f6d77Tinderbox User * Copyright (C) 1999, 2000 Internet Software Consortium.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Permission to use, copy, modify, and distribute this software for any
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * purpose with or without fee is hereby granted, provided that the above
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * copyright notice and this permission notice appear in all copies.
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉#include <isc/string.h> /* Required for HP/UX (and others?) */
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉dns_aclconfctx_init(dns_aclconfctx_t *ctx) {
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉dns_aclconfctx_destroy(dns_aclconfctx_t *ctx) {
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache);
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉convert_named_acl(char *aclname, dns_c_ctx_t *cctx,
d7201de09b85929a86b157f4b2d91667c68c6b52Automatic Updater /* Look for an already-converted version. */
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 for (dacl = ISC_LIST_HEAD(ctx->named_acl_cache);
d7201de09b85929a86b157f4b2d91667c68c6b52Automatic Updater /* Not yet converted. Convert now. */
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = dns_c_acltable_getacl(cctx->acls, aclname, &cacl);
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 isc_log_write(dns_lctx, DNS_LOGCATEGORY_SECURITY,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = dns_acl_fromconfig(cacl->ipml, cctx, ctx, mctx, &dacl);
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 ISC_LIST_APPEND(ctx->named_acl_cache, dacl, nextincache);
d7201de09b85929a86b157f4b2d91667c68c6b52Automatic Updaterconvert_keyname(char *txtname, isc_mem_t *mctx, dns_name_t *dnsname) {
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = dns_name_fromtext(dns_fixedname_name(&fixname), &buf,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 "key name \"%s\" is not a valid domain name",
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 return (dns_name_dup(dns_fixedname_name(&fixname), mctx, dnsname));
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉dns_acl_fromconfig(dns_c_ipmatchlist_t *caml,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 REQUIRE(target != NULL && *target == NULL);
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = dns_acl_create(mctx, count, &dacl);
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 de->negative = dns_c_ipmatchelement_isneg(ce);
d8f2dd46cba3a16c2433e85657a5b15543013ca6Mark Andrews isc_netaddr_fromsockaddr(&de->u.ip_prefix.address,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 /* XXX "mask" is a misnomer */
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = convert_keyname(ce->u.key, mctx,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = dns_acl_fromconfig(ce->u.indirect.list,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 result = convert_named_acl(ce->u.aclname,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 isc_log_write(dns_lctx, DNS_LOGCATEGORY_SECURITY,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 "address match list contains "
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 "unsupported element type");