Beispiel #1
0
/**
 * main
 *
 * The main task for the project. This function initializes the packages, calls
 * init_tasks to initialize additional tasks (and possibly other objects),
 * then starts serving events from default event queue.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    conf_load();

    reboot_start(hal_reset_cause());

    init_tasks();

    while (1) {
        os_eventq_run(os_eventq_dflt_get());
    }
    /* Never exit */
    return rc;
}
Beispiel #2
0
/**
 * main
 *
 * The main function for the project. This function initializes the os, calls
 * init_tasks to initialize tasks (and possibly other objects), then starts the
 * OS. We should not return from os start.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    conf_load();

    log_reboot(HARD_REBOOT);

    init_tasks();

    os_start();

    /* os start should never return. If it does, this should be an error */
    assert(0);

    return rc;
}
Beispiel #3
0
void con_load_from_file(char_t *filename)
{
	dictionary    *conf ;
	int32_t        index;
	char_t         section[128];
	char_t        *read_str;
	FILE          *fd;
	char_t         line[128];
	int32_t        conn_id;

	fd = fopen(filename, "r");
	if (fd == NULL)
	{   sprintf(line , "File read open error: %s\n",filename);
		EXERROR(line, 3);
	}
	fclose(fd);

	conf = iniparser_load(filename);
	if (conf==NULL) {
		fprintf(stdout, "cannot parse file: %s\n", filename);
		EXERROR("Critical error.", 3);
	}
	//iniparser_dump(conf, stderr);

	dmap_lock_sysdat();
	dmap_wrlock_table_pcapls();

	conf_load(conf);

	iniparser_freedict(conf);

	dmap_wrunlock_table_pcapls();
	dmap_unlock_sysdat();
}
Beispiel #4
0
/**
 * main
 *
 * The main task for the project. This function initializes the packages,
 * then starts serving events from default event queue.
 *
 * @return int NOTE: this function should never return!
 */
int
main(void)
{
    int rc;

    /* Initialize OS */
    sysinit();

    /* Initialize the blesplit log. */
    log_register("blesplit", &blesplit_log, &log_console_handler, NULL,
                 LOG_SYSLEVEL);

    /* Initialize the NimBLE host configuration. */
    log_register("ble_hs", &ble_hs_log, &log_console_handler, NULL,
                 LOG_SYSLEVEL);
    ble_hs_cfg.reset_cb = blesplit_on_reset;
    ble_hs_cfg.sync_cb = blesplit_on_sync;
    ble_hs_cfg.store_status_cb = ble_store_util_status_rr;

    /* Set the default device name. */
    rc = ble_svc_gap_device_name_set("nimble-blesplit");
    assert(rc == 0);

    conf_load();

    /*
     * As the last thing, process events from default event queue.
     */
    while (1) {
        os_eventq_run(os_eventq_dflt_get());
    }
    return 0;
}
Beispiel #5
0
int reload(struct conf *conf, const char *conffile, bool firsttime,
           int oldmax_children, int oldmax_status_children, int json)
{
    if(!firsttime) logp("Reloading config\n");

    conf_init(conf);

    if(conf_load(conffile, conf, 1)) return 1;

    /* change umask */
    umask(conf->umask);

    // Try to make JSON output clean.
    if(json) conf->log_to_stdout=0;

    // This will turn on syslogging which could not be turned on before
    // conf_load.
    set_logfp(NULL, conf);

#ifndef HAVE_WIN32
    if(conf->mode==MODE_SERVER)
        setup_signals(oldmax_children, conf->max_children,
                      oldmax_status_children, conf->max_status_children);
#endif

    // Do not try to change user or group after the first time.
    if(firsttime && chuser_and_or_chgrp(conf))
        return 1;

    return 0;
}
Beispiel #6
0
int main(int argc, char * argv[]) {
    int verbose = 0;
    int level = 0;
    FILE * dest = stderr;
    char optchar = -1;
    while (optchar = getopt(argc, argv, "c:vd:e:h")) {
        if (-1 == optchar)
            break;
        switch (optchar) {
            case 'c':
              conf.source = strdup(optarg); 
              if (NULL == conf.source) 
                  fprintf(stderr, "cannot open config file: %s\n", optarg);
              break;
            case 'v':
              verbose = 1;
              break;
            case 'e':
                if (0 == strcmp(optarg, "stderr"))
                    dest = stderr;
                else if (0 == strcmp(optarg, "stdout"))
                    dest = stdout;
                else {
                    FILE * out = fopen(optarg, "r");
                    if (NULL == out) {
                        fprintf(stderr, "failed to open destination for debug, using stderr\n");
                        dest = stderr;
                    } else
                        dest = out;
                }
                break;
            case 'd':
                level = atoi(optarg);
                break;
            case 'h':
                show_help(argv[0]);
                exit(1);
                break;
            default:
                break;
        }
    }

    if (NULL == conf.source) {
        fprintf(stderr, "no config file in use\n");
        exit(1);
    }

    dbg_init(dest, level, verbose);  

    DBG(1, "mpsd startup\n");
    if (RET_OK == conf_load(&conf)) {
        core_init(&conf);
        core_deinit(&conf);
        DBG(1, "mpsd closing\n");
    }
    conf_unload(&conf);
    return 0;
}
Beispiel #7
0
Datei: cli.c Projekt: modul/iris
static void do_load()
{
	input_stop();
	conf_load();
	OK();
	input_calibrate(CHANNELS);
	input_start();
}
Beispiel #8
0
static void init(void)
{
	acl_socket_init();
	conf_load(__conf_file);
	//acl_msg_open("dgate.log", "dgate");
	acl_msg_stdout_enable(1);
	__service = service_create("0.0.0.0", 53, var_cfg_dns_neighbor_ip,
		var_cfg_dns_neighbor_port);
	printf("neighbor dns_ip: %s, dns_port: %d\r\n",
		var_cfg_dns_neighbor_ip, var_cfg_dns_neighbor_port);
}
Beispiel #9
0
static void ipc_child_cmd_rehash( irc_t *irc, char **cmd )
{
	runmode_t oldmode;
	
	oldmode = global.conf->runmode;
	
	g_free( global.conf );
	global.conf = conf_load( 0, NULL );
	
	global.conf->runmode = oldmode;
}
Beispiel #10
0
/**
 * main
 *
 * The main task for the project. This function initializes the packages, calls
 * init_tasks to initialize additional tasks (and possibly other objects),
 * then starts serving events from default event queue.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    rc = conf_register(&test_conf_handler);
    assert(rc == 0);

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    flash_test_init();

    conf_load();

    log_reboot(hal_reset_cause());

    init_tasks();

    /* If this app is acting as the loader in a split image setup, jump into
     * the second stage application instead of starting the OS.
     */
#if MYNEWT_VAL(SPLIT_LOADER)
    {
        void *entry;
        rc = split_app_go(&entry, true);
        if(rc == 0) {
            hal_system_restart(entry);
        }
    }
#endif

    /*
     * As the last thing, process events from default event queue.
     */
    while (1) {
        os_eventq_run(os_eventq_dflt_get());
    }
}
Beispiel #11
0
/**
 * main
 *
 * The main task for the project. This function initializes the packages, calls
 * init_tasks to initialize additional tasks (and possibly other objects),
 * then starts serving events from default event queue.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    rc = conf_register(&test_conf_handler);
    assert(rc == 0);

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    /* Initialize the OIC  */
    log_register("oic", &oc_log, &log_console_handler, NULL, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    conf_load();

    reboot_start(hal_reset_cause());

#if MYNEWT_VAL(SPLIT_LOADER)
    {
        void *entry;
        rc = split_app_go(&entry, true);
        if(rc == 0) {
            hal_system_start(entry);
        }
    }
#endif

    init_tasks();

    while (1) {
        os_eventq_run(os_eventq_dflt_get());
    }
    /* Never returns */

    return rc;
}
Beispiel #12
0
int ctdbd_config_load(TALLOC_CTX *mem_ctx,
		      struct conf_context **result)
{
	struct conf_context *conf = NULL;
	int ret = 0;
	char *conf_file =  NULL;

	ret = conf_init(mem_ctx, &conf);
	if (ret != 0) {
		return ret;
	}

	logging_conf_init(conf, "NOTICE");
	cluster_conf_init(conf);
	database_conf_init(conf);
	event_conf_init(conf);
	legacy_conf_init(conf);

	setup_config_pointers(conf);

	if (! conf_valid(conf)) {
		ret = EINVAL;
		goto fail;
	}

	conf_file = path_config(conf);
	if (conf_file == NULL) {
		D_ERR("Memory allocation error\n");
		ret = ENOMEM;
		goto fail;
	}
	ret = conf_load(conf, conf_file, true);
	/* Configuration file does not need to exist */
	if (ret != 0 && ret != ENOENT) {
		D_ERR("Failed to load configuration file %s\n", conf_file);
		goto fail;
	}

	talloc_free(conf_file);
	*result = conf;

	return 0;

fail:
	talloc_free(conf);
	return ret;
}
Beispiel #13
0
static int reload_from_client_confs(struct cstat **clist, struct conf *conf)
{
	struct cstat *c;
	static struct conf *cconf=NULL;

	if(!cconf && !(cconf=conf_alloc())) goto error;

	for(c=*clist; c; c=c->next)
	{
		// Look at the client conf files to see if they have changed,
		// and reload bits and pieces if they have.
		struct stat statp;

		if(!c->conffile) continue;

		if(stat(c->conffile, &statp)
		  || !S_ISREG(statp.st_mode))
		{
			cstat_remove(clist, &c);
			continue;
		}
		if(statp.st_mtime==c->conf_mtime)
		{
			// conf file has not changed - no need to do anything.
			continue;
		}
		c->conf_mtime=statp.st_mtime;

		conf_free_content(cconf);
		if(!(cconf->cname=strdup_w(c->name, __func__)))
			goto error;
		if(conf_set_client_global(conf, cconf)
		  || conf_load(c->conffile, cconf, 0))
		{
			cstat_remove(clist, &c);
			continue;
		}

		if(set_cstat_from_conf(c, cconf))
			goto error;
	}
	return 0;
error:
	conf_free(cconf);
	cconf=NULL;
	return -1;
}
Beispiel #14
0
/**
 * main
 *
 * The main function for the project. This function initializes the os, calls
 * init_tasks to initialize tasks (and possibly other objects), then starts the
 * OS. We should not return from os start.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{
    int rc;

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif

    sysinit();

    rc = conf_register(&test_conf_handler);
    assert(rc == 0);

    cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
    log_register("log", &my_log, &log_cbmem_handler, &cbmem, LOG_SYSLEVEL);

    stats_init(STATS_HDR(g_stats_gpio_toggle),
               STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
               STATS_NAME_INIT_PARMS(gpio_stats));

    stats_register("gpio_toggle", STATS_HDR(g_stats_gpio_toggle));

    conf_load();

    log_reboot(HARD_REBOOT);

#if MYNEWT_VAL(SPLIT_LOADER)
    {
        void *entry;
        rc = split_app_go(&entry, true);
        if(rc == 0) {
            hal_system_start(entry);
        }
    }
#endif

    init_tasks();

    os_start();

    /* os start should never return. If it does, this should be an error */
    assert(0);

    return rc;
}
Beispiel #15
0
void conf_restore() {

	/* Restore */
	int ret = conf_load("/boot/default.cnf");

	/* Check checksum */
	if ((ret < 0) || (config.checksum != chksum_crc32((unsigned char *) &config, sizeof(config) - sizeof(uint32_t)))) {
		log_info("CONF_RUN_COMPILED", "");

		/* Restore compile-time configuration */
		memcpy((void *)&config, (void *) &config_compiled, sizeof(conf_t));

	} else {
		log_info("CONF_RUN_STORED", "");
	}

}
Beispiel #16
0
int syscfg_load(void)
{
	int ret;

	if (!confsvc.started) {
		DBG(DBG_WARNING, "Config service not started.");
		return -1;
	}

	pthread_mutex_lock(&confsvc.mutex);

	if ((ret = conf_load(confsvc.path, conf_root)) < 0) {
		DBG(DBG_WARNING, "conf_load() failed!");
	}

	pthread_mutex_unlock(&confsvc.mutex);
	return 0;
}
Beispiel #17
0
void ipc_master_cmd_rehash( irc_t *data, char **cmd )
{
	runmode_t oldmode;
	
	oldmode = global.conf->runmode;
	
	g_free( global.conf );
	global.conf = conf_load( 0, NULL );
	
	if( global.conf->runmode != oldmode )
	{
		log_message( LOGLVL_WARNING, "Can't change RunMode setting at runtime, restoring original setting" );
		global.conf->runmode = oldmode;
	}
	
	if( global.conf->runmode == RUNMODE_FORKDAEMON )
		ipc_to_children( cmd );
}
Beispiel #18
0
gdmaps_t* gdmaps_test_init(const char* config_path) {

    dmn_init_log();

    dmn_assert(config_path);

    const vscf_data_t* cfg_root = conf_load(config_path);
    conf_options(cfg_root);
    gdnsd_set_cfdir(config_path);

    const vscf_data_t* maps_cfg = conf_get_maps(cfg_root);
    gdmaps_t* gdmaps = gdmaps_new(maps_cfg);
    vscf_destroy(cfg_root);

    gdmaps_load_geoip_databases(gdmaps);
    gdmaps_setup_geoip_watcher_paths(gdmaps);
    gdmaps_setup_geoip_watchers(gdmaps);

    return gdmaps;
}
Beispiel #19
0
void show_sys (void){
  config_t conf;
  TM_RTC_Time_t datatime;
  conf_load(&conf);
  conf.phone[GC_PHONE_LENGTH]=0;
  TM_RTC_GetDateTime(&datatime, TM_RTC_Format_BIN);
  printf("\n\r------------------System data------------------\n\r");
  printf("ID:                   %d\n\r", conf.id[0]);
  printf("MAC address:          %02X:%02X:%02X:%02X:%02X:%02X\n\r",conf.mac[0], conf.mac[1], conf.mac[2], conf.mac[3], conf.mac[4], conf.mac[5]);
  printf("Local IP:             %d.%d.%d.%d, port: %d\n\r", conf.local_ip[0], conf.local_ip[1], conf.local_ip[2], conf.local_ip[3], conf.local_port[0]);
  printf("Remote IP:            %d.%d.%d.%d, port: %d\n\r", conf.remote_ip[0], conf.remote_ip[1], conf.remote_ip[2], conf.remote_ip[3], conf.remote_port[0]);
  printf("Current time:         %02d:%02d:%02d\n\r", datatime.hours, datatime.minutes, datatime.seconds);
  printf("Current date:         %02d.%02d.%02dr.\n\r", datatime.date, datatime.month, datatime.year);
  printf("Central phone number: %s\n\r",conf.phone);
  printf("Battery voltage:      %2.3fV\n\r",GC_BatVoltage());
  printf("Latitude:             %2.6f\n\r",conf.position_lat.f);
  printf("Longitude:            %2.6f\n\r",conf.position_long.f);
  show_ddmi();
  show_temp_humidity();
}
Beispiel #20
0
/*****************************************************************************
 * get commandline options.
 *
 * @return 0 on success, < 0 on error.
 *****************************************************************************/
int get_options( int argc, char ** argv )
{
  char c = 0;
  int not_daemon = 0, cc;
  int want_printout = 0;
  char * progname = argv[0];

  conf_defaults();

  while( (cc = getopt( argc, argv, "c:dhP")) != EOF ) {
    c = (char)cc;	//added by CMC 8/3/2001
    switch(c) {
	 case 'c':
  		conf_load(optarg);
		break;
	 case 'd':
		not_daemon = 1;
		break;
	 case 'h':
		usage(progname,"");
		return -1;
	 case 'P':
		want_printout = 1;
		break;
	 default:
		usage(progname,"");
		return -1;
    }
  }

  /** unset daemon-mode if -d was given. */
  if( not_daemon ) {
	 config.daemon_mode = 0;
  }

  if( want_printout ) {
	 conf_print();
	 exit(0);
  }
  return 0;
}
Beispiel #21
0
/*
 **************************************************************************************************
 * main
 **************************************************************************************************
 *   Main function
 **************************************************************************************************
 * Params:
 *   std main params
 **************************************************************************************************
 */
int main(int argc, char **argv)
{
  int res;
  srand((unsigned long)time(NULL));

  /* if (fork()) exit(0); */

  atexit(quit_do_cleanup);
  signal(SIGINT, quit_got_signal);
  signal(SIGTERM, quit_got_signal);
  signal(SIGHUP, sighup_rehash);

  if ((res = conf_load())) quit_service(res);
  if ((res = log_open())) quit_service(res);

  log_command(LOG_SERVICES, NULL, "", "Services startup");
  log_write("#############################################################################\n");
  
  if ((res = dbase_load_persistant())) quit_service(res);
  if ((res = queue_init())) quit_service(res);
  help_load();
  

  nickserv_dbase_checkold(NULL);
  chanserv_dbase_check_expire(NULL);
  
  pthread_mutex_init(&sock_mutex, NULL);

  irc = com_sock_create(SOCK_SERVER);
  if (!com_connect(irc)) quit_service(ERROR_SERVER_COULD_NOT_CONNECT);

  irc->buffer[0] = '\0';
  
  res = com_mainloop();

  pthread_mutex_destroy(&sock_mutex);
  
  quit_service(res);

  return res;
}
Beispiel #22
0
int main(int argc, char **argv)
{
	(void)argc;
	(void)argv;

	if (init_events_init())
		return 1;

	start_logging();

	if (init_rand_seed())
		return 1;

	if (ensure_single_instance())
		return 1;

	if (conf_load())
		return 1;

	if (cl_init())
		return 1;

	if (start_task_queue())
		return 1;

	if (start_state_manager())
		return 1;

	if (start_debug_console())
		return 1;

	if (enqueue_task(main2, NULL))
		return 1;

	if (start_rpc_svc())
		return 1;

	return 0;
}
Beispiel #23
0
static int run_status_server(int *rfd, int *cfd,
		int status_rfd, const char *conffile)
{
	int ret=-1;
	struct conf *conf=NULL;

	close_fd(rfd);

	// Reload global config, in case things have changed. This means that
	// the server does not need to be restarted for most conf changes.
	if(!(conf=conf_alloc())) goto end;
	conf_init(conf);
	if(conf_load(conffile, conf, 1)) goto end;

	ret=status_server(cfd, status_rfd, conf);

	close_fd(cfd);
end:
	logp("exit status server\n");
	conf_free(conf);
	return ret;
}
Beispiel #24
0
/**
 * main
 *
 * The main task for the project. This function initializes the packages, calls
 * init_tasks to initialize additional tasks (and possibly other objects),
 * then starts serving events from default event queue.
 *
 * @return int NOTE: this function should never return!
 */
int
main(int argc, char **argv)
{

#ifdef ARCH_sim
    mcu_sim_parse_args(argc, argv);
#endif
    /* Initialize OS */
    sysinit();

    /* Initialize BLE and OIC logs */
    ble_oic_log_init();

    /* Load config */
    conf_load();

    /* Initialize tasks */
    init_tasks();

    /* Sensor device shell init */
    sensors_dev_shell_init();

    /* Initialize BLE OIC GATT Server */
    sensor_ble_oic_server_init();

    /* log reboot */
    reboot_start(hal_reset_cause());

    /*
     * As the last thing, process events from default event queue.
     */
    while (1) {
        os_eventq_run(os_eventq_dflt_get());
    }

    return (0);
}
Beispiel #25
0
int main(void)
{
    int ret;

    ret = conf_load();
    if (ret < 0) {
        printf("Warning: fail to initialize system configuration!\n"
               "Trying reset to default!\n");

        conf_reset();
    }

    system_init();

    conf_store();

#ifdef CONFIG_AUTO_BOOT
    auto_boot();
#endif

    shell();

    return -EINVAL;
}
Beispiel #26
0
static void conf(struct menu *menu)
{
	struct menu *submenu;
	const char *prompt = menu_get_prompt(menu);
	struct symbol *sym;
	struct menu *active_menu = NULL;
	int res;
	int s_scroll = 0;

	while (1) {
		item_reset();
		current_menu = menu;
		build_conf(menu);
		if (!child_count)
			break;
		if (menu == &rootmenu) {
			item_make("--- ");
			item_set_tag(':');
			item_make(_("    Load an Alternate Configuration File"));
			item_set_tag('L');
			item_make(_("    Save an Alternate Configuration File"));
			item_set_tag('S');
		}
		dialog_clear();
		res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
				  _(menu_instructions),
				  active_menu, &s_scroll);
		if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL)
			break;
		if (!item_activate_selected())
			continue;
		if (!item_tag())
			continue;

		submenu = item_data();
		active_menu = item_data();
		if (submenu)
			sym = submenu->sym;
		else
			sym = NULL;

		switch (res) {
		case 0:
			switch (item_tag()) {
			case 'm':
				if (single_menu_mode)
					submenu->data = (void *) (long) !submenu->data;
				else
					conf(submenu);
				break;
			case 't':
				if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
					conf_choice(submenu);
				else if (submenu->prompt->type == P_MENU)
					conf(submenu);
				break;
			case 's':
				conf_string(submenu);
				break;
			case 'L':
				conf_load();
				break;
			case 'S':
				conf_save();
				break;
			}
			break;
		case 2:
			if (sym)
				show_help(submenu);
			else
				show_helptext(_("README"), _(mconf_readme));
			break;
		case 3:
			if (item_is_tag('t')) {
				if (sym_set_tristate_value(sym, yes))
					break;
				if (sym_set_tristate_value(sym, mod))
					show_textbox(NULL, setmod_text, 6, 74);
			}
			break;
		case 4:
			if (item_is_tag('t'))
				sym_set_tristate_value(sym, no);
			break;
		case 5:
			if (item_is_tag('t'))
				sym_set_tristate_value(sym, mod);
			break;
		case 6:
			if (item_is_tag('t'))
				sym_toggle_tristate_value(sym);
			else if (item_is_tag('m'))
				conf(submenu);
			break;
		case 7:
			search_conf();
			break;
		}
	}
}
Beispiel #27
0
long _IKED::init( long setlevel )
{
	//
	// initialize ike service interface
	//

	if( ikes.init() != IPCERR_OK )
	{
		printf( "Another instance of iked was detected\n" );
		return LIBIKE_FAILED;
	}

	//
	// ititialize openssl libcrypto
	//

	crypto_init();

	//
	// open our log ( debug and echo )
	//

	log.open( NULL, LLOG_DEBUG, logflags );

	//
	// load our configuration
	//

	if( !conf_load( PATH_CONF ) )
		return LIBIKE_FAILED;

	//
	// open our log ( config settings )
	//

	if( setlevel )
		level = setlevel;

	bool logging = log.open( path_log, level, logflags );
	
	//
	// output our identity
	//

	log.txt( LLOG_NONE,
		"## : IKE Daemon, ver %d.%d.%d\n"
		"## : Copyright %i Shrew Soft Inc.\n"
		"## : This product linked %s\n",
		CLIENT_VER_MAJ,
		CLIENT_VER_MIN,
		CLIENT_VER_BLD,
		CLIENT_YEAR,
		SSLeay_version( SSLEAY_VERSION ) );

	if( logflags & LOGFLAG_SYSTEM )
		log.txt( LLOG_INFO, "ii : opened system log facility\n" );
	else
	{
		if( !logging )
			log.txt( LLOG_ERROR, "!! : failed to open %s\n", path_log );
		else
			log.txt( LLOG_INFO, "ii : opened \'%s\'\n", path_log );
	}

	//
	// open our packet dump interfaces
	//

	if( dump_decrypt )
	{
		if( !pcap_decrypt.open( path_decrypt ) )
			log.txt( LLOG_ERROR, "!! : failed to open %s\n", path_decrypt );
		else
			log.txt( LLOG_INFO, "ii : opened \'%s\'\n", path_decrypt );
	}

	if( dump_encrypt )
	{
		if( !pcap_encrypt.open( path_encrypt ) )
			log.txt( LLOG_ERROR, "!! : failed to open %s\n", path_encrypt );
		else
			log.txt( LLOG_INFO, "ii : opened \'%s\'\n", path_encrypt );
	}

	//
	// load our dhcp seed file
	//

#ifdef UNIX

	bool dhcp_seed_loaded = false;

	FILE * fp = fopen( path_dhcp, "r" );
	if( fp != NULL )
	{
		unsigned int seed[ 6 ];
		if( fscanf( fp, "%02x:%02x:%02x:%02x:%x:%02x",
			&seed[ 0 ],
			&seed[ 1 ],
			&seed[ 2 ],
			&seed[ 3 ],
			&seed[ 4 ],
			&seed[ 5 ] ) == 6 )
		{
			dhcp_seed[ 0 ] = ( char ) seed[ 0 ];
			dhcp_seed[ 1 ] = ( char ) seed[ 1 ];
			dhcp_seed[ 2 ] = ( char ) seed[ 2 ];
			dhcp_seed[ 3 ] = ( char ) seed[ 3 ];
			dhcp_seed[ 4 ] = ( char ) seed[ 4 ];
			dhcp_seed[ 5 ] = ( char ) seed[ 5 ];
			dhcp_seed_loaded = true;
		}

		fclose( fp );
	}

	if( dhcp_seed_loaded == false )
	{
		FILE * fp = fopen( path_dhcp, "w" );
		if( fp != NULL )
		{
			rand_bytes( dhcp_seed, 6 );
			unsigned int seed[ 6 ];
			seed[ 0 ] = dhcp_seed[ 0 ];
			seed[ 1 ] = dhcp_seed[ 1 ];
			seed[ 2 ] = dhcp_seed[ 2 ];
			seed[ 3 ] = dhcp_seed[ 3 ];
			seed[ 4 ] = dhcp_seed[ 4 ];
			seed[ 5 ] = dhcp_seed[ 5 ];

			if( fprintf( fp, "%02x:%02x:%02x:%02x:%02x:%02x",
				seed[ 0 ],
				seed[ 1 ],
				seed[ 2 ],
				seed[ 3 ],
				seed[ 4 ],
				seed[ 5 ] ) != 18 )
				dhcp_seed_loaded = true;
			else
				log.txt( LLOG_ERROR, "!! : failed to write dhcp seed to %s\n", path_dhcp );

			fclose( fp );
		}
		else
			log.txt( LLOG_ERROR, "!! : failed to create dhcp seed to %s\n", path_dhcp );
	}

#endif

	//
	// initialize our vnet interface
	//

	vnet_init();

	//
	// initialize our socket interface
	//

	socket_init();

	//
	// setup natt port on OSX systems
	//

#ifdef __APPLE__

	int natt_port = LIBIKE_NATT_PORT;

	sysctlbyname(
		"net.inet.ipsec.esp_port",
		NULL, NULL,
		&natt_port, sizeof( natt_port ) );

#endif

	//
	// default socket initialization
	//

	if( !sock_ike_open )
	{
		IKE_SADDR saddr;
		memset( &saddr, 0, sizeof( saddr ) );
		SET_SALEN( &saddr.saddr4, sizeof( sockaddr_in ) );
		saddr.saddr4.sin_family	= AF_INET;
		saddr.saddr4.sin_port = htons( LIBIKE_IKE_PORT );

		if( socket_create( saddr, false ) != LIBIKE_OK )
		{
			char txtaddr[ 16 ];
			text_addr( txtaddr, &saddr, true );
			log.txt( LLOG_ERROR,
				"!! : unable to open ike socket for %s\n",
				txtaddr );

			return LIBIKE_FAILED;
		}
	}

#ifdef OPT_NATT

	if( !sock_natt_open )
	{
		IKE_SADDR saddr;
		memset( &saddr, 0, sizeof( saddr ) );
		SET_SALEN( &saddr.saddr4, sizeof( sockaddr_in ) );
		saddr.saddr4.sin_family	= AF_INET;
		saddr.saddr4.sin_port = htons( LIBIKE_NATT_PORT );

		if( socket_create( saddr, true ) != LIBIKE_OK )
		{
			char txtaddr[ 16 ];
			text_addr( txtaddr, &saddr, true );
			log.txt( LLOG_ERROR,
				"!! : unable to open natt socket for %s\n",
				txtaddr );

			return LIBIKE_FAILED;
		}
	}

#endif

	return LIBIKE_OK;
}
Beispiel #28
0
/**************************************************************************************************
	LOAD_CONFIG
	Load the configuration file.
**************************************************************************************************/
void
load_config(void) {
    int		n;
    struct passwd *pwd = NULL;
    struct group	*grp = NULL;

    /* Load config */
    conf_load(&Conf, opt_conf);

    /* Set defaults */
    for (n = 0; defConfig[n].name; n++) {
        if (defConfig[n].name[0] == '-' || !defConfig[n].value)
            continue;
        if (!conf_get(&Conf, defConfig[n].name, NULL))
            conf_set(&Conf, defConfig[n].name, defConfig[n].value, 1);
    }

    /* Support "mysql-user" etc. for backwards compatibility */
    if (conf_get(&Conf, "mysql-host", NULL))
        conf_set(&Conf, "db-host", conf_get(&Conf, "mysql-host", NULL), 0);
    if (conf_get(&Conf, "mysql-user", NULL))
        conf_set(&Conf, "db-user", conf_get(&Conf, "mysql-user", NULL), 0);
    if (conf_get(&Conf, "mysql-pass", NULL))
        conf_set(&Conf, "db-password", conf_get(&Conf, "mysql-pass", NULL), 0);
    if (conf_get(&Conf, "mysql-password", NULL))
        conf_set(&Conf, "db-password", conf_get(&Conf, "mysql-password", NULL), 0);

#if HAVE_GETPWUID
    /* Set default for database username to real username if none was provided */
    if (!conf_get(&Conf, "db-user", NULL)) {
        struct passwd *pwd2;

        if ((pwd2 = getpwuid(getuid())) && pwd2->pw_name) {
            conf_set(&Conf, "db-user", pwd2->pw_name, 0);
            memset(pwd2, 0, sizeof(struct passwd));
        }
    }
#endif

    /* Load user/group perms */
    if (!(pwd = getpwnam(conf_get(&Conf, "user", NULL))))
        Err(_("error loading uid for user `%s'"), conf_get(&Conf, "user", NULL));
    perms_uid = pwd->pw_uid;
    perms_gid = pwd->pw_gid;
    memset(pwd, 0, sizeof(struct passwd));

    if (!(grp = getgrnam(conf_get(&Conf, "group", NULL))) && !(grp = getgrnam("nobody"))) {
        Warnx(_("error loading gid for group `%s'"), conf_get(&Conf, "group", NULL));
        Warnx(_("using gid %lu from user `%s'"), (unsigned long)perms_gid, conf_get(&Conf, "user", NULL));
    } else {
        perms_gid = grp->gr_gid;
        memset(grp, 0, sizeof(struct group));
    }

    /* We call conf_set_logging() again after moving into background, but it's called here
       to report on errors. */
    conf_set_logging();

    /* Set global options */
    task_timeout = atou(conf_get(&Conf, "timeout", NULL));

    axfr_enabled = GETBOOL(conf_get(&Conf, "allow-axfr", NULL));
    Verbose(_("AXFR is %senabled"), (axfr_enabled)?"":_("not "));

    tcp_enabled = GETBOOL(conf_get(&Conf, "allow-tcp", NULL));
    Verbose(_("TCP ports are %senabled"), (tcp_enabled)?"":_("not "));

    dns_update_enabled = GETBOOL(conf_get(&Conf, "allow-update", NULL));
    Verbose(_("DNS UPDATE is %senabled"), (dns_update_enabled)?"":_("not "));

    mydns_soa_use_active = GETBOOL(conf_get(&Conf, "use-soa-active", NULL));
    mydns_rr_use_active = GETBOOL(conf_get(&Conf, "use-rr-active", NULL));

    dns_notify_enabled = dns_update_enabled && GETBOOL(conf_get(&Conf, "notify-enabled", NULL));
    Verbose(_("DNS NOTIFY is %senabled"), (dns_notify_enabled)?"":_("not "));
    notify_timeout = atou(conf_get(&Conf, "notify-timeout", NULL));
    notify_retries = atou(conf_get(&Conf, "notify-retries", NULL));
    notify_algorithm = conf_get(&Conf, "notify-algorithm", NULL);

    dns_ixfr_enabled = GETBOOL(conf_get(&Conf, "ixfr-enabled", NULL));
    Verbose(_("DNS IXFR is %senabled"), (dns_ixfr_enabled)?"":_("not "));
    ixfr_gc_enabled = GETBOOL(conf_get(&Conf, "ixfr-gc-enabled", NULL));
    ixfr_gc_interval = atou(conf_get(&Conf, "ixfr-gc-interval", NULL));
    ixfr_gc_delay = atou(conf_get(&Conf, "ixfr-gc-delay", NULL));

    mydns_rr_extended_data = GETBOOL(conf_get(&Conf, "extended-data-support", NULL));

    mydns_dbengine = conf_get(&Conf, "dbengine", NULL);

    wildcard_recursion = atoi(conf_get(&Conf, "wildcard-recursion", NULL));

    ignore_minimum = GETBOOL(conf_get(&Conf, "ignore-minimum", NULL));

    /* Set table names if provided */
    mydns_set_soa_table_name(conf_get(&Conf, "soa-table", NULL));
    mydns_set_rr_table_name(conf_get(&Conf, "rr-table", NULL));

    /* Set additional where clauses if provided */
    mydns_set_soa_where_clause(conf_get(&Conf, "soa-where", NULL));
    mydns_set_rr_where_clause(conf_get(&Conf, "rr-where", NULL));

    /* Set recursive server if specified */
    conf_set_recursive();

#ifdef DN_COLUMN_NAMES
    dn_default_ns = conf_get(&Conf, "default-ns", NULL);
#endif
}
Beispiel #29
0
END_TEST

START_TEST (test_conf_errors)
{
  configuration *conf;
  int ret;
  int i;
  unsigned int u;
  char c;
  int bt;
  int bf;
  float f;
  const char *s;
  int valid;

  /*
   * Test Add group errors.
   */
  conf = conf_create ();
  fail_unless (conf != 0);

  /* Add group to non conf. */
  ret = conf_add_group (NULL, NULL, head_group);
  fail_unless (ret == -1);
  conf_free (conf);

  /* Add two groups with no group name under root. */
  conf = conf_create ();
  fail_unless (conf != 0);
  ret = conf_add_group (conf, NULL, head_group);
  fail_unless (ret == 0);
  ret = conf_add_group (conf, NULL, head_group);
  fail_unless (ret == -1);
  conf_free (conf);

  /* Add group with bad parameter type. */
  conf = conf_create ();
  fail_unless (conf != 0);
  ret = conf_add_group (conf, NULL, bad_1_group);
  fail_unless (ret < 0);
  conf_free (conf);

  /*
   * Test load errors.
   */
  conf = conf_create ();
  fail_unless (conf != 0);

  /* Load with no groups. */
  ret = conf_load (conf, CONFDIR "test.conf");
  fail_unless (ret == -1);

  /* Test filename. */
  ret = conf_add_group (conf, "a group", head_group);
  fail_unless (ret == 0);
  ret = conf_load (conf, NULL);
  fail_unless (ret == -1);
  ret = conf_load (conf, "/dev/null/something");
  fail_unless (ret == -1);

  /* Test group names. */
  ret = conf_load (conf, CONFDIR "test_bad1.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad2.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad3.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad4.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad5.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad6.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad7.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad8.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad9.conf");
  fail_unless (ret < 0);
  ret = conf_load (conf, CONFDIR "test_bad10.conf");
  fail_unless (ret != 0);
  ret = conf_add_group (conf, NULL, head_group);
  fail_unless (ret == 0);
  ret = conf_load (conf, CONFDIR "test_bad11.conf");
  fail_unless (ret == -15, "%d", ret);
  ret = conf_load (conf, CONFDIR "test_bad12.conf");
  fail_unless (ret == -13);
  ret = conf_load (conf, CONFDIR "test_bad13.conf");
  fail_unless (ret != -14);
  ret = conf_load (conf, CONFDIR "test_bad14.conf");
  fail_unless (ret == -17, "%d", ret);

  conf_free (conf);

  /* Test getting values */
  conf = conf_create ();
  fail_unless (conf != 0);
  ret = conf_add_group (conf, "a group", head_group);
  fail_unless (ret == 0);

  i = conf_get_int (conf, NULL, "h_int", &valid);
  fail_unless (valid == 0);
  u = conf_get_uint (conf, NULL, "h_uint", &valid);
  fail_unless (valid == 0);
  c = conf_get_char (conf, NULL, "h_char", &valid);
  fail_unless (valid == 0);
  bf = conf_get_bool (conf, NULL, "h_bool_false", &valid);
  fail_unless (valid == 0);
  bt = conf_get_bool (conf, NULL, "h_bool_true", &valid);
  fail_unless (valid == 0);
  f = conf_get_float (conf, NULL, "h_float", &valid);
  fail_unless (valid == 0);
  s = conf_get_string (conf, NULL, "h_string", &valid);
  fail_unless (valid == 0);

  i = conf_get_int (conf, "a group", "X_int", &valid);
  fail_unless (valid == 0);
  u = conf_get_uint (conf, "a group", "X_uint", &valid);
  fail_unless (valid == 0);
  c = conf_get_char (conf, "a group", "X_char", &valid);
  fail_unless (valid == 0);
  bf = conf_get_bool (conf, "a group", "X_bool_false", &valid);
  fail_unless (valid == 0);
  bt = conf_get_bool (conf, "a group", "X_bool_true", &valid);
  fail_unless (valid == 0);
  f = conf_get_float (conf, "a group", "X_float", &valid);
  fail_unless (valid == 0);
  s = conf_get_string (conf, "a group", "X_string", &valid);
  fail_unless (valid == 0);

  conf_free (conf);
}
Beispiel #30
0
END_TEST

START_TEST (test_conf_file)
{
  configuration *conf;
  int ret;
  int i;
  unsigned int u;
  char c;
  int bt;
  int bf;
  float f;
  const char *s;
  int valid;

  conf = conf_create ();
  fail_unless (conf != 0);

  ret = conf_add_group (conf, NULL, head_group);
  fail_unless (ret == 0);
  ret = conf_add_group (conf, "agroup", head_group);
  fail_unless (ret == 0);
  ret = conf_add_group (conf, "c group", head_group);
  fail_unless (ret == 0);
  ret = conf_add_group (conf, "b group", head_group);
  fail_unless (ret == 0);
  ret = conf_add_group (conf, "e group", head_group);
  fail_unless (ret == 0);
  ret = conf_add_group (conf, "d group", head_group);
  fail_unless (ret == 0);
  ret = conf_load (conf, CONFDIR "test.conf");
  fail_unless (ret == 0, "ret = %d", ret);

  i = conf_get_int (conf, NULL, "h_int", &valid);
  fail_unless (valid == 1);
  fail_unless (i == 10, "Got %d expected %d", i, 10);
  u = conf_get_uint (conf, NULL, "h_uint", &valid);
  fail_unless (valid == 1);
  fail_unless (u == 55, "Got %u expected %u", u, 55);
  c = conf_get_char (conf, NULL, "h_char", &valid);
  fail_unless (valid == 1);
  fail_unless (c == 'B', "Got %c expected %c", c, 'B');
  bf = conf_get_bool (conf, NULL, "h_bool_false", &valid);
  fail_unless (valid == 1);
  fail_unless (bf == 0, "Got %d expected %d", bf, 0);
  bt = conf_get_bool (conf, NULL, "h_bool_true", &valid);
  fail_unless (valid == 1);
  fail_unless (bt == 1, "Got %d expected %d", i, 1);
  f = conf_get_float (conf, NULL, "h_float", &valid);
  fail_unless (valid == 1);
  fail_unless (abs (f - 15.5f) < 0.0001f, "Got %f expected %f", f, 15.5f);
  s = conf_get_string (conf, NULL, "h_string", &valid);
  fail_unless (valid == 1);
  fail_unless (strcasecmp (s, "Not Default") == 0,
	       "Got %d expected 'Not Default", i);

  i = conf_get_int (conf, "agroup", "h_int", &valid);
  fail_unless (valid == 1);
  fail_unless (i == 10, "Got %d expected %d", i, 10);
  u = conf_get_uint (conf, "agroup", "h_uint", &valid);
  fail_unless (valid == 1);
  fail_unless (u == 75, "Got %u expected %u", u, 75);
  c = conf_get_char (conf, "agroup", "h_char", &valid);
  fail_unless (valid == 1);
  fail_unless (c == 'B', "Got %c expected %c", c, 'B');
  bf = conf_get_bool (conf, "agroup", "h_bool_false", &valid);
  fail_unless (valid == 1);
  fail_unless (bf == 0, "Got %d expected %d", bf, 0);
  bt = conf_get_bool (conf, "agroup", "h_bool_true", &valid);
  fail_unless (valid == 1);
  fail_unless (bt == 1, "Got %d expected %d", i, 1);
  f = conf_get_float (conf, "agroup", "h_float", &valid);
  fail_unless (valid == 1);
  fail_unless (abs (f - 15.5f) < 0.0001f, "Got %f expected %f", f, 15.5f);
  s = conf_get_string (conf, "agroup", "h_string", &valid);
  fail_unless (valid == 1);
  fail_unless (strcasecmp (s, "Not") == 0, "Got '%s' expected 'Not'", s);

  i = conf_get_int (conf, "b group", "h_int", &valid);
  fail_unless (valid == 1);
  fail_unless (i == 10, "Got %d expected %d", i, 10);
  u = conf_get_uint (conf, "b group", "h_uint", &valid);
  fail_unless (valid == 1);
  fail_unless (u == 85, "Got %u expected %u", u, 85);
  c = conf_get_char (conf, "b group", "h_char", &valid);
  fail_unless (valid == 1);
  fail_unless (c == 'B', "Got %c expected %c", c, 'B');
  bf = conf_get_bool (conf, "b group", "h_bool_false", &valid);
  fail_unless (valid == 1);
  fail_unless (bf == 0, "Got %d expected %d", bf, 0);
  bt = conf_get_bool (conf, "b group", "h_bool_true", &valid);
  fail_unless (valid == 1);
  fail_unless (bt == 1, "Got %d expected %d", i, 1);
  f = conf_get_float (conf, "b group", "h_float", &valid);
  fail_unless (valid == 1);
  fail_unless (abs (f + 25.5f) < 0.0001f, "Got %f expected %f", f, -25.5f);
  s = conf_get_string (conf, "b group", "h_string", &valid);
  fail_unless (valid == 1);
  fail_unless (strcasecmp (s, "Not Default") == 0,
	       "Got %d expected 'Not Default", i);

  i = conf_get_int (conf, "c group", "h_int", &valid);
  fail_unless (valid == 1);
  fail_unless (i == -16, "Got %d expected %d", i, -16);
  u = conf_get_uint (conf, "c group", "h_uint", &valid);
  fail_unless (valid == 1);
  fail_unless (u == 16, "Got %u expected %u", u, 16);
  c = conf_get_char (conf, "c group", "h_char", &valid);
  fail_unless (valid == 1);
  fail_unless (c == '\0', "Got %c expected %c", c, '\0');
  bf = conf_get_bool (conf, "c group", "h_bool_false", &valid);
  fail_unless (valid == 1);
  fail_unless (bf == 0, "Got %d expected %d", bf, 0);
  bt = conf_get_bool (conf, "c group", "h_bool_true", &valid);
  fail_unless (valid == 1);
  fail_unless (bt == 1, "Got %d expected %d", i, 1);
  f = conf_get_float (conf, "c group", "h_float", &valid);
  fail_unless (valid == 1);
  fail_unless (abs (f - 15.5f) < 0.0001f, "Got %f expected %f", f, 15.5f);
  s = conf_get_string (conf, "c group", "h_string", &valid);
  fail_unless (valid == 1);
  fail_unless (strcasecmp (s, " Not Default") == 0,
	       "Got %d expected 'Not Default", s);

  i = conf_get_int (conf, "d group", "h_int", &valid);
  fail_unless (valid == 1);
  fail_unless (i == 100, "Got %d expected %d", i, 100);
  u = conf_get_uint (conf, "d group", "h_uint", &valid);
  fail_unless (valid == 1);
  fail_unless (u == 100, "Got %u expected %u", u, 100);
  c = conf_get_char (conf, "d group", "h_char", &valid);
  fail_unless (valid == 1);
  fail_unless (c == '\07', "Got %c expected %c", c, '\07');
  bf = conf_get_bool (conf, "d group", "h_bool_false", &valid);
  fail_unless (valid == 1);
  fail_unless (bf == 0, "Got %d expected %d", bf, 0);
  bt = conf_get_bool (conf, "d group", "h_bool_true", &valid);
  fail_unless (valid == 1);
  fail_unless (bt == 1, "Got %d expected %d", i, 1);
  f = conf_get_float (conf, "d group", "h_float", &valid);
  fail_unless (valid == 1);
  fail_unless (abs (f - 100.0f) < 0.0001f, "Got %f expected %f", f, +100.0f);
  s = conf_get_string (conf, "d group", "h_string", &valid);
  fail_unless (valid == 1);
  fail_unless (strcasecmp (s, "\b\v\t\n\r\f\a\\\?\'\"\x10\010") == 0,
	       "Got %d expected 'Not Default", s);

  i = conf_get_int (conf, "e group", "h_int", &valid);
  fail_unless (valid == 1);
  fail_unless (i == -100, "Got %d expected %d", i, -100);
  u = conf_get_uint (conf, "e group", "h_uint", &valid);
  fail_unless (valid == 1);
  fail_unless (u == 0, "Got %u expected %u", u, 0);
  c = conf_get_char (conf, "e group", "h_char", &valid);
  fail_unless (valid == 1);
  fail_unless (c == '\t', "Got %c expected %c", c, '\t');
  bf = conf_get_bool (conf, "e group", "h_bool_false", &valid);
  fail_unless (valid == 1);
  fail_unless (bf == 0, "Got %d expected %d", bf, 0);
  bt = conf_get_bool (conf, "e group", "h_bool_true", &valid);
  fail_unless (valid == 1);
  fail_unless (bt == 1, "Got %d expected %d", i, 1);
  f = conf_get_float (conf, "e group", "h_float", &valid);
  fail_unless (valid == 1);
  fail_unless (abs (f + 100) < 0.0001f, "Got %f expected %f", f, -100.0f);
  s = conf_get_string (conf, "e group", "h_string", &valid);
  fail_unless (valid == 1);
  fail_unless (strlen (s) == 0, "Got '%s' expected ''", s);

  conf_free (conf);
}