zoneconf.c revision 4035d3325043d565ab78cff562bc365c4bc46da2
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington/*
5fa46bc91672ef5737aee6f99763161511566c24Tinderbox User * Copyright (C) 1999, 2000 Internet Software Consortium.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews *
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 *
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
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * SOFTWARE.
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews#include <config.h>
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#include <isc/assertions.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#include <isc/error.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#include <isc/mem.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#include <isc/result.h>
f4b4e7c16211137332e50bcad3fef0d15639a4f1Brian Wellington
f4b4e7c16211137332e50bcad3fef0d15639a4f1Brian Wellington#include <dns/aclconf.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#include <dns/types.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#include <dns/zone.h>
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#include <dns/zoneconf.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#include <dns/ssu.h>
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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
229ce407c359b0b641759ba1fc4a5fa2054a44daBrian Wellington/*
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington * Convenience function for configuring a single zone ACL.
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic isc_result_t
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 *),
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington void (*clearzacl)(dns_zone_t *))
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington{
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_result_t result;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_ipmatchlist_t *cacl;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_acl_t *dacl = NULL;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = (*getcacl)(czone, &cacl);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result == ISC_R_NOTFOUND && getviewcacl != NULL && cview != NULL) {
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington result = (*getviewcacl)(cview, &cacl);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington }
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington if (result == ISC_R_NOTFOUND && getglobalcacl != NULL) {
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = (*getglobalcacl)(cctx, &cacl);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington }
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result == ISC_R_SUCCESS) {
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_acl_fromconfig(cacl, cctx, aclconfctx,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_getmctx(zone), &dacl);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_ipmatchlist_detach(&cacl);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (result);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington (*setzacl)(zone, dacl);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_acl_detach(&dacl);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (ISC_R_SUCCESS);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington } else if (result == ISC_R_NOTFOUND) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington (*clearzacl)(zone);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (ISC_R_SUCCESS);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington } else {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (result);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington }
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington}
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtonstatic dns_zonetype_t
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellingtondns_zonetype_fromconf(dns_c_zonetype_t cztype) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington switch (cztype) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington case dns_c_zone_master:
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return dns_zone_master;
229ce407c359b0b641759ba1fc4a5fa2054a44daBrian Wellington case dns_c_zone_forward:
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return dns_zone_forward;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington case dns_c_zone_slave:
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return dns_zone_slave;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington case dns_c_zone_stub:
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return dns_zone_stub;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington case dns_c_zone_hint:
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return dns_zone_hint;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington }
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington INSIST(0);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (dns_zone_none); /*NOTREACHED*/
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington}
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonisc_result_t
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_c_zone_t *czone, dns_aclconfctx_t *ac,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_t *zone)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington{
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_result_t result;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_boolean_t boolean;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington const char *filename = NULL;
92ef1a9b9dbd48ecb507b42ac62c15afefdaf838David Lawrence#ifdef notyet
571688b02f955f6304649866e768b1f81739cbedBrian Wellington dns_c_severity_t severity;
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#endif
571688b02f955f6304649866e768b1f81739cbedBrian Wellington dns_c_iplist_t *iplist = NULL;
571688b02f955f6304649866e768b1f81739cbedBrian Wellington isc_uint32_t i;
571688b02f955f6304649866e768b1f81739cbedBrian Wellington isc_sockaddr_t sockaddr;
571688b02f955f6304649866e768b1f81739cbedBrian Wellington isc_int32_t maxxfr;
571688b02f955f6304649866e768b1f81739cbedBrian Wellington in_port_t port;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington struct in_addr in4addr_any;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_sockaddr_t sockaddr_any4, sockaddr_any6;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_ssutable_t *ssutable;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington in4addr_any.s_addr = htonl(INADDR_ANY);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein isc_sockaddr_fromin(&sockaddr_any4, &in4addr_any, 0);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington isc_sockaddr_fromin6(&sockaddr_any6, &in6addr_any, 0);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setclass(zone, czone->zclass);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington /* XXX needs to be an zone option */
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_setdbtype(zone, "rbt");
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (result);
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews switch (czone->ztype) {
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews case dns_c_zone_master:
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews dns_zone_settype(zone, dns_zone_master);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington result = dns_c_zone_getfile(czone, &filename);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington if (result != ISC_R_SUCCESS)
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington return (result);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington result = dns_zone_setdatabase(zone, filename);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington if (result != ISC_R_SUCCESS)
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington return (result);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington#ifdef notyet
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington result = dns_c_zone_getchecknames(czone, &severity);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington if (result == ISC_R_SUCCESS)
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington dns_zone_setchecknames(zone, severity);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington else
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_fail);
557bcc2092642b2d4668c9b08872c9f2bb88bddbMark Andrews#endif
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington result = configure_zone_acl(czone, cctx, NULL, ac, zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_zone_getallowupd,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington NULL, NULL,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_setupdateacl,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_clearupdateacl);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result != ISC_R_SUCCESS)
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington return (result);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_zone_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_view_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_ctx_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setqueryacl,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_clearqueryacl);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (result);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_zone_getallowtransfer,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_view_gettransferacl,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_ctx_getallowtransfer,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setxfracl,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_clearxfracl);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (result);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getdialup(czone, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#ifdef notyet
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_view_getdialup(cview, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#endif
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_ctx_getdialup(cctx, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington boolean = ISC_FALSE;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
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 if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_ctx_getnotify(cctx, &boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington boolean = ISC_TRUE;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_clearnotify(zone);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getalsonotify(czone, &iplist);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result == ISC_R_SUCCESS) {
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington for (i = 0; i < iplist->nextidx; i++) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_addnotify(zone,
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington &iplist->ips[i]);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (result);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington }
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington }
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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 if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington maxxfr = MAX_XFER_TIME;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setmaxxfrout(zone, maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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 if (result != ISC_R_SUCCESS)
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington maxxfr = DNS_DEFAULT_IDLEOUT;
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_setidleout(zone, maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington ssutable = NULL;
75e1e12f48012505699f504cfa364260cb2bc1afBrian Wellington result = dns_c_zone_getssuauth(czone, &ssutable);
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews if (result == ISC_R_SUCCESS) {
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_ssutable_t *newssutable = NULL;
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_ssutable_attach(ssutable, &newssutable);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington dns_zone_setssutable(zone, newssutable);
23f64ea0dcd7f5b7094ae6ade2a002fb7dde1466Brian Wellington }
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews break;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington case dns_c_zone_forward:
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington#ifdef notyet
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington /*
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington * forward zones are still in a state of flux
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington czone->u.fzone.check_names; /* XXX unused in BIND 8 */
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington czone->u.fzone.forward; /* XXX*/
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington czone->u.fzone.forwarders; /* XXX*/
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#endif
18d0b5e54be891a1aa938c165b6d439859121ec8Mark Andrews break;
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington case dns_c_zone_slave:
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_settype(zone, dns_zone_slave);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_zone_getfile(czone, &filename);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result != ISC_R_SUCCESS)
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington return (result);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington result = dns_zone_setdatabase(zone, filename);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington return (result);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington#ifdef notyet
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington result = dns_c_zone_getchecknames(czone, &severity);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington if (result == ISC_R_SUCCESS)
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington dns_zone_setchecknames(zone, severity);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington else
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_warn);
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington#endif
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_zone_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_view_getallowquery,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_c_ctx_getallowquery,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_setqueryacl,
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_clearqueryacl);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington return (result);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_zone_getmasterport(czone, &port);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result != ISC_R_SUCCESS)
e2fd12f3a020ca8c5de168a44fb72e339cdaa3e9Brian Wellington port = 53;
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_setmasterport(zone, port);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington dns_zone_clearmasters(zone);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_c_zone_getmasterips(czone, &iplist);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington if (result == ISC_R_SUCCESS) {
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington for (i = 0; i < iplist->nextidx; i++) {
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_zone_addmaster(zone,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington &iplist->ips[i]);
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson return (result);
de32cbd34e78bdd276e69cff239846760d4ee16eBrian Wellington }
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews }
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington if (result != ISC_R_SUCCESS)
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington if (result != ISC_R_SUCCESS)
d2aebe24c477c70e79dc33ea0507e8886eb7d626Brian Wellington maxxfr = MAX_XFER_TIME;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setmaxxfrin(zone, maxxfr);
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
75582adac73202213d936dc0850f1c9cf47d6cbeMark Andrews if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington maxxfr = DNS_DEFAULT_IDLEIN;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setidlein(zone, maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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 if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington sockaddr = sockaddr_any4;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setxfrsource4(zone, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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 if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington sockaddr = sockaddr_any6;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setxfrsource6(zone, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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 if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_getmaxtransfertimeout(cctx, &maxxfr);
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updater if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington maxxfr = MAX_XFER_TIME;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setmaxxfrout(zone, maxxfr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
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 if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getmaxtransferidleout(cctx, &maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson maxxfr = DNS_DEFAULT_IDLEOUT;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setidleout(zone, maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getdialup(czone, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson#ifdef notyet
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS && cview != NULL)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_view_getdialup(cview, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson#endif
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getdialup(cctx, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson boolean = ISC_FALSE;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setoption(zone, DNS_ZONE_O_DIALUP, boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
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);
2f012d936b5ccdf6520c96a4de23721dc58a2221Automatic Updater if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getnotify(cctx, &boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson boolean = ISC_TRUE;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setoption(zone, DNS_ZONE_O_NOTIFY, boolean);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_clearnotify(zone);
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrews result = dns_c_zone_getalsonotify(czone, &iplist);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result == ISC_R_SUCCESS) {
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson for (i = 0; i < iplist->nextidx; i++) {
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_zone_addnotify(zone,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson &iplist->ips[i]);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson return (result);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson }
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson }
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson break;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson case dns_c_zone_stub:
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_settype(zone, dns_zone_stub);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getfile(czone, &filename);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson return (result);
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrews result = dns_zone_setdatabase(zone, filename);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
daa73eae708d568d453e6082e0890d35886a9e0fMark Andrews return (result);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson#ifdef notyet
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getchecknames(czone, &severity);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result == ISC_R_SUCCESS)
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington dns_zone_setchecknames(zone, severity);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington else
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_warn);
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington#endif
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington result = configure_zone_acl(czone, cctx, cview, ac, zone,
a4c351fcef77fb332e3cb20253fb96556a414a17Brian Wellington dns_c_zone_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_view_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_c_ctx_getallowquery,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setqueryacl,
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_clearqueryacl);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson return (result);
6c7f722d31d12cf83964c8132f0a59ef70e34cb5Mark Andrews
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getmasterport(czone, &port);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington port = 53;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setmasterport(zone, port);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_clearmasters(zone);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_zone_getmasterips(czone, &iplist);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews if (result == ISC_R_SUCCESS) {
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson for (i = 0; i < iplist->nextidx; i++) {
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_zone_addmaster(zone,
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson &iplist->ips[i]);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson return (result);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson }
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson }
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_zone_getmaxtranstimein(czone, &maxxfr);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson result = dns_c_ctx_getmaxtransfertimein(cctx, &maxxfr);
229ce407c359b0b641759ba1fc4a5fa2054a44daBrian Wellington if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson maxxfr = MAX_XFER_TIME;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setmaxxfrin(zone, maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_zone_getmaxtransidlein(czone, &maxxfr);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews if (result != ISC_R_SUCCESS)
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews result = dns_c_ctx_getmaxtransferidlein(cctx, &maxxfr);
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews if (result != ISC_R_SUCCESS)
6b79e960e6ba2991aeb02a6c39af255ab7f06d99Mark Andrews maxxfr = DNS_DEFAULT_IDLEIN;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setidlein(zone, maxxfr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
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 if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersource(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson sockaddr = sockaddr_any4;
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_setxfrsource4(zone, &sockaddr);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
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 if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington result = dns_c_ctx_gettransfersourcev6(cctx, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington if (result != ISC_R_SUCCESS)
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington sockaddr = sockaddr_any6;
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington dns_zone_setxfrsource6(zone, &sockaddr);
033ba09d6df0ac92a736a480b9c3b164b61dccb2Brian Wellington
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson case dns_c_zone_hint:
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson dns_zone_settype(zone, dns_zone_hint);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getfile(czone, &filename);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (result);
77ac297199fc44809d9628558223627c10ae3f31Brian Wellington result = dns_zone_setdatabase(zone, filename);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (result);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#ifdef notyet
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_zone_getchecknames(czone, &severity);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result == ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setchecknames(zone, severity);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington else
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zone_setchecknames(zone, dns_c_severity_fail);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington#endif
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington break;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington }
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (ISC_R_SUCCESS);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington}
307d2084502eddc7ce921e5ce439aec3531d90e0Tatuya JINMEI 神明達哉
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonisc_boolean_t
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zone_reusable(dns_zone_t *zone, dns_c_zone_t *czone)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington{
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington const char *cfilename;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington const char *zfilename;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (dns_zonetype_fromconf(czone->ztype) != dns_zone_gettype(zone))
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (ISC_FALSE);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington cfilename = NULL;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington (void) dns_c_zone_getfile(czone, &cfilename);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington zfilename = dns_zone_getdatabase(zone);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (cfilename == NULL || zfilename == NULL ||
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington strcmp(cfilename, zfilename) != 0)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (ISC_FALSE);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington /* XXX Compare masters, too. */
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington return (ISC_TRUE);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington}
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtonisc_result_t
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellingtondns_zonemgr_configure(dns_c_ctx_t *cctx, dns_zonemgr_t *zmgr)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington{
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington isc_int32_t val;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington isc_result_t result;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington result = dns_c_ctx_gettransfersin(cctx, &val);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington if (result != ISC_R_SUCCESS)
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington val = 10;
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington dns_zonemgr_settransfersin(zmgr, val);
60b90a37f41ab7607762d0e9791e79bd19eae4f4Brian Wellington
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson return (ISC_R_SUCCESS);
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson}
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson
307ba34fa07db768c3a899844f248a2c1d7dcc7fAndreas Gustafsson