zoneconf.c revision 22eeba5ec6b621eb81aec084a1a4e0776aee0f41
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * Copyright (C) 1999 Internet Software Consortium.
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * Permission to use, copy, modify, and distribute this software for any
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * purpose with or without fee is hereby granted, provided that the above
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * 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
c9defbf4b968e8a61f391246431ac63d0d6a39abMichael Sawyer/* XXX copied from zone.c */
c9defbf4b968e8a61f391246431ac63d0d6a39abMichael Sawyer#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours. */
aa6054ec74819f754bcf19442ca9b39d948171adMichael Sawyer * Convenience function for configuring a single zone ACL.
aa6054ec74819f754bcf19442ca9b39d948171adMichael Sawyerconfigure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx,
aa6054ec74819f754bcf19442ca9b39d948171adMichael Sawyer dns_aclconfctx_t *aclconfctx, dns_zone_t *zone,
aa6054ec74819f754bcf19442ca9b39d948171adMichael Sawyer isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **),
d821f1cd7e97552401296e880e7518c98c9ebea1Michael Sawyer result = dns_acl_fromconfig(cacl, cctx, aclconfctx,
6c6a62933dda281cb9193de1d54d4c9e74515f5aMichael Sawyerdns_zonetype_fromconf(dns_c_zonetype_t cztype) {
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyerdns_zone_configure(dns_c_ctx_t *cctx, dns_aclconfctx_t *ac,
a5ed46c9fd270775c39770bfd0250a52d374ebf2Michael Sawyer isc_sockaddr_fromin(&sockaddr_any4, &in4addr_any, 0);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer /* XXX needs to be an zone option */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getfile(czone, &filename);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_zone_setdatabase(zone, filename);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getchecknames(czone, &severity);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_zone_setchecknames(zone, dns_c_severity_fail);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = configure_zone_acl(czone, cctx, ac, zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = configure_zone_acl(czone, cctx, ac, zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = configure_zone_acl(czone, cctx, ac, zone,
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer result = configure_zone_acl(czone, cctx, ac, zone,
38cf6e52ce4b33795713388824b69d78e430b115Michael Sawyer result = dns_c_zone_getdialup(czone, &boolean);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
38cf6e52ce4b33795713388824b69d78e430b115Michael Sawyer dns_zone_clearoption(zone, DNS_ZONE_O_DIALUP);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getnotify(czone, &boolean);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer dns_zone_clearoption(zone, DNS_ZONE_O_NOTIFY);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getalsonotify(czone, &iplist);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
cefd68008fbba3488a077052ae62aa12b6de502bMichael Sawyer * forward zones are still in a state of flux
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer czone->u.fzone.check_names; /* XXX unused in BIND 8 */
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getfile(czone, &filename);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_zone_setdatabase(zone, filename);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getchecknames(czone, &severity);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_zone_setchecknames(zone, dns_c_severity_warn);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = configure_zone_acl(czone, cctx, ac, zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmasterport(czone, &port);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmasterips(czone, &iplist);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_gettransfersource(czone, &sockaddr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getfile(czone, &filename);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_zone_setdatabase(zone, filename);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getchecknames(czone, &severity);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer dns_zone_setchecknames(zone, dns_c_severity_warn);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = configure_zone_acl(czone, cctx, ac, zone,
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmasterport(czone, &port);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmasterips(czone, &iplist);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
6fe03d6c83ec02d4494edc870f5e892d419b6885Michael Sawyer result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_c_zone_gettransfersource(czone, &sockaddr);
38cf6e52ce4b33795713388824b69d78e430b115Michael Sawyer result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_c_zone_getfile(czone, &filename);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_zone_setdatabase(zone, filename);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer result = dns_c_zone_getchecknames(czone, &severity);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer dns_zone_setchecknames(zone, dns_c_severity_fail);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerdns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer if (dns_zonetype_fromconf(czone->ztype) != dns_zone_gettype(zone))
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer (void) dns_c_zone_getfile(czone, &cfilename);
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer if (cfilename == NULL || zfilename == NULL ||
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyer /* XXX Compare masters, too. */
844eaa56d6d647b38b2a5cf08f7ea5ab7b752690Michael Sawyerdns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr)