zoneconf.c revision 37cf280f4913d821a01d7d98e9208bc6b58881a6
5fa46bc91672ef5737aee6f99763161511566c24Tinderbox User * Copyright (C) 1999, 2000 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * Permission to use, copy, modify, and distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer/* XXX copied from zone.c */
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours. */
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer * Convenience function for configuring a single zone ACL.
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerconfigure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview,
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **),
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer isc_result_t (*getviewcacl)(dns_c_view_t *, dns_c_ipmatchlist_t **),
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer isc_result_t (*getglobalcacl)(dns_c_ctx_t *, dns_c_ipmatchlist_t **),
7e9d637131516486630290d36c4c0db544cb700eMark Andrews if (result == ISC_R_NOTFOUND && getviewcacl != NULL && cview != NULL) {
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer if (result == ISC_R_NOTFOUND && getglobalcacl != NULL) {
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_acl_fromconfig(cacl, cctx, aclconfctx,
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerdns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
7e9d637131516486630290d36c4c0db544cb700eMark Andrews isc_sockaddr_fromin(&sockaddr_any4, &in4addr_any, 0);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer isc_sockaddr_fromin6(&sockaddr_any6, &in6addr_any, 0);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer /* XXX needs to be an zone option */
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getchecknames(czone, &severity);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer dns_zone_setchecknames(zone, dns_c_severity_fail);
7829fad4093f2c1985b1efb7cea00287ff015d2bckb result = configure_zone_acl(czone, cctx, NULL, ac, zone,
8e6b386ab7e2d1bd8efedecbb8f4efb6b572a866Tinderbox User result = configure_zone_acl(czone, cctx, cview, ac, zone,
7829fad4093f2c1985b1efb7cea00287ff015d2bckb result = configure_zone_acl(czone, cctx, cview, ac, zone,
e76d4c91bfadf823f04dcca1c1c5bcc14c67671dAndreas Gustafsson result = dns_c_view_getnotify(cview, &boolean);
e76d4c91bfadf823f04dcca1c1c5bcc14c67671dAndreas Gustafsson result = dns_c_ctx_getnotify(cctx, &boolean);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getalsonotify(czone, &iplist);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_zone_setnotifyalso(zone, iplist->ips,
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
1e71bc82b8e1a95d423d8db1c136080dc034433dAndreas Gustafsson result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
68c2ccc953059f389cefc0f8a5ce0f83be7458c9Danny Mayer result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
68c2ccc953059f389cefc0f8a5ce0f83be7458c9Danny Mayer result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getssuauth(czone, &ssutable);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer * forward zones are still in a state of flux
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer czone->u.fzone.check_names; /* XXX unused in BIND 8 */
e76d4c91bfadf823f04dcca1c1c5bcc14c67671dAndreas Gustafsson result = dns_c_zone_getfile(czone, &filename);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getchecknames(czone, &severity);
bb48ac4f813537a060579615a52f9c7963f5e3c4Danny Mayer dns_zone_setchecknames(zone, dns_c_severity_warn);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = configure_zone_acl(czone, cctx, cview, ac, zone,
bdec94477cc9ecac9ff14d3399f47f3d71cd370aAndreas Gustafsson result = dns_c_zone_getmasterips(czone, &iplist);
754cb8a2b33fa6cfaa15d6470f66e5fb0eab4764Automatic Updater result = dns_zone_setmasters(zone, iplist->ips,
bdec94477cc9ecac9ff14d3399f47f3d71cd370aAndreas Gustafsson result = dns_zone_setmasters(zone, NULL, 0);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
528baec07b1b9a566d47fc638ba5cbbe01475c74Andreas Gustafsson result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
528baec07b1b9a566d47fc638ba5cbbe01475c74Andreas Gustafsson result = dns_c_zone_gettransfersource(czone, &sockaddr);
528baec07b1b9a566d47fc638ba5cbbe01475c74Andreas Gustafsson if (result != ISC_R_SUCCESS && cview != NULL)
528baec07b1b9a566d47fc638ba5cbbe01475c74Andreas Gustafsson result = dns_c_view_gettransfersource(cview, &sockaddr);
b602bf9e8b67cb2b1ff9ee8b2a48793bf6c70e16Danny Mayer result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
b602bf9e8b67cb2b1ff9ee8b2a48793bf6c70e16Danny Mayer result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
754cb8a2b33fa6cfaa15d6470f66e5fb0eab4764Automatic Updater if (result != ISC_R_SUCCESS && cview != NULL)
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
bb48ac4f813537a060579615a52f9c7963f5e3c4Danny Mayer result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence result = dns_c_zone_getdialup(czone, &boolean);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
8b7304a34c751e519ede7d00b77f1f962c0a37e4David Lawrence result = dns_c_zone_getnotify(czone, &boolean);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
bbb3705e4cbdacf7cf6da7e448d79d97fdab2411Mark Andrews result = dns_c_zone_getalsonotify(czone, &iplist);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_zone_setnotifyalso(zone, iplist->ips,
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getchecknames(czone, &severity);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews dns_zone_setchecknames(zone, dns_c_severity_warn);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = configure_zone_acl(czone, cctx, cview, ac, zone,
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_zone_getmasterips(czone, &iplist);
135bcc2e42a94543f11af2a4196b13552ab46d89Automatic Updater result = dns_zone_setmasters(zone, NULL, 0);
433e06a25cdd92d665abda3e64c2c65f4a3f9b21Mark Andrews result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_zone_gettransfersource(czone, &sockaddr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_view_gettransfersource(cview, &sockaddr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews result = dns_c_zone_getchecknames(czone, &severity);
7e9d637131516486630290d36c4c0db544cb700eMark Andrews dns_zone_setchecknames(zone, dns_c_severity_fail);
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayerdns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer if (dns_zonetype_fromconf(czone->ztype) != dns_zone_gettype(zone))
e35c1bb3ecd9a6597360b9160b397c8053af69bfDanny Mayer /* XXX Compare masters, too. */