zoneconf.c revision ff4322d44f8404683b6fb6c86a38a2bc14f6c083
803d8426030e1f40c45d6861e95587189173f368Tinderbox User * Copyright (C) 1999-2001 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
1633838b8255282d10af15c5c84cee5a51466712Bob Halley * copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/* $Id: zoneconf.c,v 1.93 2001/09/25 23:01:15 gson Exp $ */
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley#include <isc/string.h> /* Required for HP/UX (and others?) */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * These are BIND9 server defaults, not necessarily identical to the
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * library defaults defined in zone.c.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein#define RETERR(x) do { \
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * Convenience function for configuring a single zone ACL.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinconfigure_zone_acl(cfg_obj_t *zconfig, cfg_obj_t *vconfig, cfg_obj_t *config,
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein result = ns_acl_fromconfig(aclobj, config, actx,
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein * Parse the zone update-policy statement.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinconfigure_zone_ssutable(cfg_obj_t *zconfig, dns_zone_t *zone) {
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein (void)cfg_map_get(zconfig, "update-policy", &updatepolicy);
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein cfg_obj_t *identity = cfg_tuple_get(stmt, "identity");
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein cfg_obj_t *matchtype = cfg_tuple_get(stmt, "matchtype");
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein cfg_obj_t *typelist = cfg_tuple_get(stmt, "types");
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein unsigned int i, n;
9b80f3a7c739a99b498a37a711a51b6a88df3a78Mark Andrews result = dns_name_fromtext(dns_fixedname_name(&fident), &b,
0cae66577c69c89086cd065bb297690072b471b4Mark Andrews cfg_obj_log(identity, ns_g_lctx, ISC_LOG_ERROR,
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley result = dns_name_fromtext(dns_fixedname_name(&fname), &b,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt types = isc_mem_get(mctx, n * sizeof(dns_rdatatype_t));
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt isc_mem_put(mctx, types, n * sizeof(dns_rdatatype_t));
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * Convert a config file zone type into a server zone type.
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * Helper function for strtoargv(). Pardon the gratuitous recursion.
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntstrtoargvsub(isc_mem_t *mctx, char *s, unsigned int *argcp,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt char ***argvp, unsigned int n)
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt /* Discard leading whitespace. */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt if (*s == '\0') {
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt /* We have reached the end of the string. */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt char *p = s;
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt if (*p != '\0')
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt *p++ = '\0';
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt result = strtoargvsub(mctx, p, argcp, argvp, n + 1);
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * Tokenize the string "s" into whitespace-separated words,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * return the number of words in '*argcp' and an array
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * of pointers to the words in '*argvp'. The caller
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * must free the array using isc_mem_put(). The string
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * is modified in-place.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinstrtoargv(isc_mem_t *mctx, char *s, unsigned int *argcp, char ***argvp) {
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein return (strtoargvsub(mctx, s, argcp, argvp, 0));
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austeinns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt unsigned int dbargc;
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RETERR(ns_config_getclass(cfg_tuple_get(vconfig, "class"),
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley * Configure values common to all zone types.
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RETERR(ns_config_getclass(cfg_tuple_get(zconfig, "class"),
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RETERR(strtoargv(mctx, cpval, &dbargc, &dbargv));
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley * ANSI C is strange here. There is no logical reason why (char **)
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley * cannot be promoted automatically to (const char * const *) by the
96754ed7b400ce080279de2f92111ad868105290Bob Halley * compiler w/o generating a warning.
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RETERR(dns_zone_setdbtype(zone, dbargc, (const char * const *)dbargv));
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley isc_mem_put(mctx, dbargv, dbargc * sizeof(*dbargv));
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RETERR(configure_zone_acl(zconfig, vconfig, config,
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley * XXXAG This probably does not make sense for stubs.
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley RETERR(configure_zone_acl(zconfig, vconfig, config,
34b394b43e2207e8f8f3703f0402422121455638David Lawrence else if (strcasecmp(dialupstr, "notify-passive") == 0)
34b394b43e2207e8f8f3703f0402422121455638David Lawrence else if (strcasecmp(dialupstr, "refresh") == 0)
34b394b43e2207e8f8f3703f0402422121455638David Lawrence result = ns_config_get(maps, "zone-statistics", &obj);
34b394b43e2207e8f8f3703f0402422121455638David Lawrence dns_zone_setstatistics(zone, cfg_obj_asboolean(obj));
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellington * Configure master functionality. This applies
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * to primary masters (type "master") and slaves
c07c2a862e0f9d671e2961cd179c7b28d7b04f10Mark Andrews * acting as masters (type "slave"), but not to stubs.
INSIST(0);
return (result);
return (result);
value);
zname);
switch (ztype) {
case dns_zone_slave:
case dns_zone_stub:
&count));
count);
return (ISC_R_SUCCESS);
const char *cfilename;
const char *zfilename;
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);