zoneconf.c revision 4035d3325043d565ab78cff562bc365c4bc46da2
5fa46bc91672ef5737aee6f99763161511566c24Tinderbox User * Copyright (C) 1999, 2000 Internet Software Consortium.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * 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
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * copyright notice and this permission notice appear in all copies.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * 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
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington/* XXX copied from zone.c */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define MAX_XFER_TIME (2*3600) /* Documented default is 2 hours. */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_DEFAULT_IDLEIN 3600 /* 1 hour */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#define DNS_DEFAULT_IDLEOUT 3600 /* 1 hour */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Convenience function for configuring a single zone ACL.
77ac297199fc44809d9628558223627c10ae3f31Brian Wellingtonconfigure_zone_acl(dns_c_zone_t *czone, dns_c_ctx_t *cctx, dns_c_view_t *cview,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_aclconfctx_t *aclconfctx, dns_zone_t *zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_result_t (*getcacl)(dns_c_zone_t *, dns_c_ipmatchlist_t **),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_result_t (*getviewcacl)(dns_c_view_t *, dns_c_ipmatchlist_t **),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_result_t (*getglobalcacl)(dns_c_ctx_t *, dns_c_ipmatchlist_t **),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington void (*setzacl)(dns_zone_t *, dns_acl_t *),
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result == ISC_R_NOTFOUND && getviewcacl != NULL && cview != NULL) {
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington if (result == ISC_R_NOTFOUND && getglobalcacl != NULL) {
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_acl_fromconfig(cacl, cctx, aclconfctx,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zonetype_fromconf(dns_c_zonetype_t cztype) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_sockaddr_t sockaddr_any4, sockaddr_any6;
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein isc_sockaddr_fromin(&sockaddr_any4, &in4addr_any, 0);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_sockaddr_fromin6(&sockaddr_any6, &in6addr_any, 0);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* XXX needs to be an zone option */
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington result = dns_c_zone_getfile(czone, &filename);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington result = dns_zone_setdatabase(zone, filename);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington result = dns_c_zone_getchecknames(czone, &severity);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_fail);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington result = configure_zone_acl(czone, cctx, NULL, ac, zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getdialup(czone, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_view_getdialup(cview, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_ctx_getdialup(cctx, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getnotify(czone, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_view_getnotify(cview, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_ctx_getnotify(cctx, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getalsonotify(czone, &iplist);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington result = dns_c_zone_getssuauth(czone, &ssutable);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_ssutable_attach(ssutable, &newssutable);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * forward zones are still in a state of flux
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington czone->u.fzone.check_names; /* XXX unused in BIND 8 */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_zone_getfile(czone, &filename);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington result = dns_zone_setdatabase(zone, filename);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington result = dns_c_zone_getchecknames(czone, &severity);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_warn);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_zone_getmasterport(czone, &port);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_zone_getmasterips(czone, &iplist);
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_gettransfersource(czone, &sockaddr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS && cview != NULL)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_view_gettransfersource(cview, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_getmaxtranstimeout(czone, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_view_getmaxtransfertimeout(cview, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_getmaxtransidleout(czone, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_view_getmaxtransferidleout(cview, &maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getdialup(czone, &boolean);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_view_getdialup(cview, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getdialup(cctx, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getnotify(czone, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS && cview != NULL)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_view_getnotify(cview, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getnotify(cctx, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrews result = dns_c_zone_getalsonotify(czone, &iplist);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getfile(czone, &filename);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getchecknames(czone, &severity);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_warn);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getmasterport(czone, &port);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_zone_getmasterips(czone, &iplist);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_gettransfersource(czone, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_view_gettransfersource(cview, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_zone_gettransfersourcev6(czone, &sockaddr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS && cview != NULL)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_view_gettransfersourcev6(cview, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getfile(czone, &filename);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_zone_setdatabase(zone, filename);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getchecknames(czone, &severity);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_fail);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (dns_zonetype_fromconf(czone->ztype) != dns_zone_gettype(zone))
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington (void) dns_c_zone_getfile(czone, &cfilename);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (cfilename == NULL || zfilename == NULL ||
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington /* XXX Compare masters, too. */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr)