zoneconf.c revision e82d19b0c77c8e408b3c1fb2e34488d4993f4b21
1413616670fcb95b9ef236351502e4884ddca8bfTinderbox 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
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * 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
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence/* XXX copied from zone.c */
21f1794606dce19928cf455029e173321f166380Mark Andrews#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours. */
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * Convenience function for configuring a single zone ACL.
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrenceconfigure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview,
21825a8d005ccc2dfaf12889bf9eef3413555277Brian Wellington dns_aclconfctx_t *aclconfctx, dns_zone_t *zone,
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉 isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **),
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence isc_result_t (*getviewcacl)(dns_c_view_t *, dns_c_ipmatchlist_t **),
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews isc_result_t (*getglobalcacl)(dns_c_ctx_t *, dns_c_ipmatchlist_t **),
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson if (result == ISC_R_NOTFOUND && getviewcacl != NULL && cview != NULL) {
9ac7076ebad044afb15e9e2687e3696868778538Mark Andrews if (result == ISC_R_NOTFOUND && getglobalcacl != NULL) {
9ac7076ebad044afb15e9e2687e3696868778538Mark Andrews result = dns_acl_fromconfig(cacl, cctx, aclconfctx,
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_zonetype_fromconf(dns_c_zonetype_t cztype) {
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson isc_sockaddr_t sockaddr_any4, sockaddr_any6;
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein isc_sockaddr_fromin(&sockaddr_any4, &in4addr_any, 0);
e672951ed28b2e9cc7a19c3d7fa4a258382f981cAutomatic Updater isc_sockaddr_fromin6(&sockaddr_any6, &in6addr_any, 0);
2383eb527269d333df4222da20e4b422c3662daaEvan Hunt /* XXX needs to be an zone option */
9fe8cca06537c45375c1e1d36b82501caf0ae090Francis Dupont result = dns_c_zone_getfile(czone, &filename);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_zone_getchecknames(czone, &severity);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_setchecknames(zone, dns_c_severity_fail);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = configure_zone_acl(czone, cctx, NULL, ac, zone,
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = configure_zone_acl(czone, cctx, cview, ac, zone,
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = configure_zone_acl(czone, cctx, cview, ac, zone,
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_zone_getdialup(czone, &boolean);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_clearoption(zone, DNS_ZONE_O_DIALUP);
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews result = dns_c_zone_getnotify(czone, &boolean);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_clearoption(zone, DNS_ZONE_O_NOTIFY);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_zone_getalsonotify(czone, &iplist);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson if (result != ISC_R_SUCCESS && cview != NULL)
76c8294c81fb48b1da6e1fc5b83322a4cedb8e58Andreas Gustafsson result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
fd4810861c0c0ccb9aebde94e9d289442b2630dbMark Andrews result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
fd4810861c0c0ccb9aebde94e9d289442b2630dbMark Andrews result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence if (result != ISC_R_SUCCESS && cview != NULL)
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews result = dns_c_zone_getssuauth(czone, &ssutable);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * forward zones are still in a state of flux
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews czone->u.fzone.check_names; /* XXX unused in BIND 8 */
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_zone_getchecknames(czone, &severity);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews dns_zone_setchecknames(zone, dns_c_severity_warn);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = configure_zone_acl(czone, cctx, cview, ac, zone,
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_zone_getmasterport(czone, &port);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_zone_getmasterips(czone, &iplist);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews result = dns_c_zone_gettransfersource(czone, &sockaddr);
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews result = dns_c_view_gettransfersource(cview, &sockaddr);
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
b6a0341bcb113e93bd0bc41a9f9a1fc117444da6Mark Andrews result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
bddfe77128b0f16af263ff149db40f0d885f43d0Mark Andrews result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
f6407f9a0b890bebbfd5f738d9c4aef3d3315fe9Michael Graff result = dns_c_zone_getfile(czone, &filename);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews result = dns_c_zone_getchecknames(czone, &severity);
bed8e84810a80dad3d37870be927d1dfd015f480Mark Andrews dns_zone_setchecknames(zone, dns_c_severity_warn);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews result = configure_zone_acl(czone, cctx, cview, ac, zone,
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews result = dns_c_zone_getmasterport(czone, &port);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews result = dns_c_zone_getmasterips(czone, &iplist);
389c749a5ee18f1c0d6278ae49f2aae5d5f0d2dcMark Andrews result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
389c749a5ee18f1c0d6278ae49f2aae5d5f0d2dcMark Andrews result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
cabaeca9ae5b98c80586b91e89cf552e17a75a9bBrian Wellington result = dns_c_zone_gettransfersource(czone, &sockaddr);
cabaeca9ae5b98c80586b91e89cf552e17a75a9bBrian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
cabaeca9ae5b98c80586b91e89cf552e17a75a9bBrian Wellington result = dns_c_view_gettransfersource(cview, &sockaddr);
c03bb27f0675a6e60ceea66b451548e8481bc05cMark Andrews result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
29c818c7d40fc8898b062903ec703851328a4deaMark Andrews result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
29c818c7d40fc8898b062903ec703851328a4deaMark Andrews result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
29c818c7d40fc8898b062903ec703851328a4deaMark Andrews result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
735ca24fa61ad9cd0285776c2fc4c14032f8f194Mark Andrews result = dns_c_zone_getchecknames(czone, &severity);
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews dns_zone_setchecknames(zone, dns_c_severity_fail);
44a966dff66061ac3f266c6b451a70733eb78e82Mark Andrewsdns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
90e303b114e56db5809fdd19805243457fa43cd9Olafur Gudmundsson if (dns_zonetype_fromconf(czone->ztype) != dns_zone_gettype(zone))
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrews /* XXX Compare masters, too. */