zoneconf.c revision 92a31c0f86de860a540e24b1337a8c9bfad56876
28d9fd53819cc163629c867466b20d8ebcae8842David Lawrence * Copyright (C) 1999, 2000 Internet Software Consortium.
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * Permission to use, copy, modify, and distribute this software for any
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * purpose with or without fee is hereby granted, provided that the above
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews * copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
15a44745412679c30a6d022733925af70a38b715David Lawrence * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
15a44745412679c30a6d022733925af70a38b715David Lawrence * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15a44745412679c30a6d022733925af70a38b715David Lawrence * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15a44745412679c30a6d022733925af70a38b715David Lawrence * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
15a44745412679c30a6d022733925af70a38b715David Lawrence * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff#include <isc/string.h> /* Required for HP/UX (and others?) */
0c310d16b05ee94743d33f6920907edee6084fc8Michael Graff * These are BIND9 server defaults, not necessarily identical to the
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence * library defaults defined in zone.c.
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours. */
a98551ef592e9be6008e0141ceeb32efd586c5efMark Andrews#define RETERR(x) do { \
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson * Convenience function for configuring a single zone ACL.
600cfa2ba4c50017581b6c14e3a688a82ecebbe0David Lawrenceconfigure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview,
600cfa2ba4c50017581b6c14e3a688a82ecebbe0David Lawrence dns_aclconfctx_t *aclconfctx, dns_zone_t *zone,
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence if (result == ISC_R_NOTFOUND && getviewcacl != NULL && cview != NULL) {
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence if (result == ISC_R_NOTFOUND && getglobalcacl != NULL) {
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence result = dns_acl_fromconfig(cacl, cctx, aclconfctx,
0c8649cea98afc061dd2938fd315df53b8fc35caAndreas Gustafsson * Conver a config file zone type into a server zone type.
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_zonetype_fromconf(dns_c_zonetype_t cztype) {
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Hint and forward zones are not really zones;
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * they should never get this far.
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencedns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Configure values common to all zone types.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_settype(zone, dns_zonetype_fromconf(czone->ztype));
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence /* XXX needs to be an zone option */
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence RETERR(dns_c_zone_getfile(czone, &filename));
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence RETERR(dns_zone_setdatabase(zone, filename));
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence result = dns_c_zone_getchecknames(czone, &severity);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence dns_zone_setchecknames(zone, dns_c_severity_warn);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * XXXAG This probably does not make sense for stubs.
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence RETERR(configure_zone_acl(czone, cctx, cview, ac, zone,
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence result = dns_c_zone_getdialup(czone, &boolean);
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence result = dns_c_ctx_getdialup(cctx, &boolean);
fd4810861c0c0ccb9aebde94e9d289442b2630dbMark Andrews dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * Configure master functionality. This applies
8abddcd3f24476b945419659e7cb73bcb970886bDavid Lawrence * to primary masters (type "master") and slaves
7ab0e69f61e61e81d489c95c7ebd981e74e7ef16Andreas Gustafsson * acting as masters (type "slave"), but not to stubs.
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_zone_getnotify(czone, &boolean);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_view_getnotify(cview, &boolean);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_zone_getalsonotify(czone, &iplist);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_view_getalsonotify(cview, &iplist);
2002be4f65776451676df6ee21a2e28f52bcad6dMark Andrews result = dns_c_ctx_getalsonotify(cctx, &iplist);
f6407f9a0b890bebbfd5f738d9c4aef3d3315fe9Michael Graff RETERR(dns_zone_setalsonotify(zone, iplist->ips,
ffe74cc719aa0f10c38fbc1f2f3ea7db0960cb8fMark Andrews RETERR(configure_zone_acl(czone, cctx, cview, ac, zone,
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews result = dns_c_view_getmaxtransfertimeout(cview,
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington result = dns_c_view_getmaxtransferidleout(cview,
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington * Configure update-related options. These apply to
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington * primary masters only.
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington RETERR(configure_zone_acl(czone, cctx, NULL, ac, zone,
54c26ab21c61c6d6b1e484bb88dc3ac263845d17Mark Andrews result = dns_c_zone_getssuauth(czone, &ssutable);
bcd7fdf06ca76eb2f6eb157f56b612c503e062a7Mark Andrews * Configure slave functionality.
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_zone_getmasterips(czone, &iplist);
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_zone_setmasters(zone, iplist->ips,
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_zone_setmasters(zone, NULL, 0);
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
94a537e6ab3069f8d34e12e5ea722250be2b89c8Michael Graff result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
94a537e6ab3069f8d34e12e5ea722250be2b89c8Michael Graff result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_zone_gettransfersource(czone, &sockaddr);
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence if (result != ISC_R_SUCCESS && cview != NULL)
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_view_gettransfersource(cview,
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson if (result != ISC_R_SUCCESS && cview != NULL)
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_view_gettransfersourcev6(cview,
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson result = dns_c_ctx_gettransfersourcev6(cctx,
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafssondns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone) {
3ddd92da6651bc72aa79a04195ad389d86fd1a66Andreas Gustafsson if (dns_zonetype_fromconf(czone->ztype) != dns_zone_gettype(zone))
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrews /* XXX Compare masters, too. */
5d51e67c3b4f35c1be742574aacc1d88fe6ed444Mark Andrewsdns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr) {