static void load_acl(struct Configuration *cfg, const struct ConfParse *parse, const struct CF_Child *parent) { struct CF_Token value = confparse_node_gettoken(parse, parent, 1); struct Cfg_AddrMatchList *acl; /* address-lists must be named when inside an "acl" statement */ if (value.name_length == 0) { CONF_VALUE_MISSING(parse, &value); return; } /* parse the address-list */ acl = conf_load_addrlist(cfg, parse, parent, &value, 65536); if (acl == NULL) return; /* make sure it has a name */ acl->name = malloc(value.name_length + 1); memcpy(acl->name, value.name, value.name_length + 1); /* * Add to our named set of address-lists. This is so that later * configuration parameters can refer back to this list rather than * redefining their own */ if (cfg->acls_length == 0) cfg->acls = malloc(sizeof(cfg->acls[0])); else cfg->acls = realloc(cfg->acls, sizeof(cfg->acls[0]) * (cfg->acls_length + 1)); cfg->acls[cfg->acls_length++] = acl; }
void conf_load_zone_item( struct Configuration *cfg, const struct ConfParse *parse, const struct CF_Child *parent, struct Cfg_Zone *zone ) { struct CF_Token token = confparse_node_gettoken(parse, parent, 0); struct CF_Token value = confparse_node_gettoken(parse, parent, 1); switch (lookup_token(&token)) { case S_TYPE: if (zone->type != 0) CONF_OPTION_DUPLICATE(parse, &token); switch (lookup_token(&value)) { case S_MASTER: zone->type = CFGZ_MASTER; break; case S_SLAVE: zone->type = CFGZ_SLAVE; break; default: CONF_VALUE_BAD(parse, &value); } break; case S_FILE: if (zone->file != 0) { CONF_OPTION_DUPLICATE(parse, &token); free(zone->file); zone->file = NULL; } if (value.name_length == 0) { CONF_VALUE_BAD(parse, &value); } else { zone->file = filename_combine(cfg->options.directory, value.name); } break; case S_ALLOW_NOTIFY: if (zone->allow_notify) { CONF_OPTION_DUPLICATE(parse, &token); conf_addrmatch_free(zone->allow_notify); zone->allow_notify = NULL; } zone->allow_notify = conf_load_addrlist(cfg, parse, parent, 0, 65536); break; case S_ALLOW_TRANSFER: if (zone->allow_transfer) { CONF_OPTION_DUPLICATE(parse, &token); conf_addrmatch_free(zone->allow_transfer); zone->allow_transfer = NULL; } zone->allow_transfer = conf_load_addrlist(cfg, parse, parent, 0, 65536); break; case S_ALSO_NOTIFY: if (zone->also_notify) { CONF_OPTION_DUPLICATE(parse, &token); conf_addrmatch_free(zone->also_notify); zone->also_notify = NULL; } zone->also_notify = conf_load_addrlist(cfg, parse, parent, 0, 65536); break; default: CONF_OPTION_UNKNOWN(parse, &token); break; } }