Ejemplo n.º 1
0
static ya_result config_zone_section_print(config_data *config)
{
    zone_set_lock(&config->zones);

    if(!treeset_avl_isempty(&config->zones.set))
    {
        treeset_avl_iterator iter;
        treeset_avl_iterator_init(&config->zones.set, &iter);

        while(treeset_avl_iterator_hasnext(&iter))
        {
            treeset_node *zone_node = treeset_avl_iterator_next_node(&iter);
            zone_data *zone_desc = (zone_data*)zone_node->data;
            print("<zone>\n");
            confs_print(zone_tab, zone_desc);
            print("</zone>\n");
        }

        zone_set_unlock(&config->zones);
    }
    else
    {
        zone_set_unlock(&config->zones);

        print("# no zone\n");
    }

    return SUCCESS;
}
Ejemplo n.º 2
0
static ya_result
config_section_zone_print_wild(struct config_section_descriptor_s *csd, output_stream *os, const char *key)
{
    if(key != NULL)
    {
        return ERROR;
    }
    
    // for all zones, print table of the zone
    
    zone_set_lock(&database_zone_desc);
    
    ptr_set_avl_iterator iter;
    ptr_set_avl_iterator_init(&database_zone_desc.set, &iter);

    while(ptr_set_avl_iterator_hasnext(&iter))
    {
        ptr_node *zone_node = ptr_set_avl_iterator_next_node(&iter);
        zone_desc_s *zone_desc = (zone_desc_s *)zone_node->value;
        
        config_section_struct_print(csd, zone_desc, os);
    }
    
    zone_set_unlock(&database_zone_desc);
    
    return SUCCESS;
}
Ejemplo n.º 3
0
static ya_result
config_zone_section_assign(config_data *config)
{
    u32 port = 0;
    ya_result return_code;

    config_zone_section_register(config);

    if(FAIL(return_code = parse_u32_check_range(config->server_port, &port, 1, MAX_U16, 10)))
    {
        osformatln(termerr, "config: zone: wrong dns port set in main '%s': %r", config->server_port, return_code);

        return return_code;
    }

    zone_set_lock(&config->zones);

    treeset_avl_iterator iter;
    treeset_avl_iterator_init(&config->zones.set, &iter);

    while(treeset_avl_iterator_hasnext(&iter))
    {
        treeset_node *zone_node = treeset_avl_iterator_next_node(&iter);
        zone_data *zone = (zone_data *)zone_node->data;

        zone_setdefaults(zone);

        if(!config_check_bounds_s32(SIGNATURE_VALIDITY_INTERVAL_MIN, SIGNATURE_VALIDITY_INTERVAL_MAX, zone->sig_validity_interval, "sig-validity-interval"))
        {
            return ERROR;
        }

        if(!config_check_bounds_s32(SIGNATURE_VALIDITY_REGENERATION_MIN, SIGNATURE_VALIDITY_REGENERATION_MAX, zone->sig_validity_regeneration, "sig-validity-regeneration"))
        {
            return ERROR;
        }

        if(!config_check_bounds_s32(SIGNATURE_VALIDITY_JITTER_MIN, SIGNATURE_VALIDITY_JITTER_MAX, zone->sig_validity_jitter, "sig-validity-jitter"))
        {
            return ERROR;
        }

        if(!config_check_bounds_s32(NOTIFY_RETRY_COUNT_MIN, NOTIFY_RETRY_COUNT_MAX, zone->notify.retry_count, "notify-retry-count"))
        {
            return ERROR;
        }

        if(!config_check_bounds_s32(NOTIFY_RETRY_PERIOD_MIN, NOTIFY_RETRY_PERIOD_MAX, zone->notify.retry_period, "notify-period-count"))
        {
            return ERROR;
        }

        if(!config_check_bounds_s32(NOTIFY_RETRY_PERIOD_INCREASE_MIN, NOTIFY_RETRY_PERIOD_INCREASE_MAX, zone->notify.retry_period_increase, "notify-period-increase"))
        {
            return ERROR;
        }

        zone->ctrl_flags |= ZONE_CTRL_FLAG_READ_FROM_CONF;
    }

    zone_set_unlock(&config->zones);

    return SUCCESS;
}