Exemplo n.º 1
0
int nodeup_setup(char *configfile) {
    /* initialize our new clean configuration to default values */
    tc.fd            = -1;
    tc.listen_path   = strdup(DEFAULT_LISTENPATH);
    tc.worker        = strdup(DEFAULT_WORKER);
    tc.max_clients   = DEFAULT_MAXCLIENTS;
    tc.startup_delay = DEFAULT_STARTUPDELAY;
    tc.log_level     = DEFAULT_LOGLEVEL;

    if (cmconf_process_file(configfile, configopts)) {
	config_free(&tc);
	return -1;
    }

    if (conf.listen_path && strcmp(tc.listen_path, conf.listen_path) == 0) {
	tc.fd = conf.fd;
	conf.fd = -1;
    } else {
	tc.fd = nodeup_setup_listen(tc.listen_path);\
    }
    clients = realloc(clients, sizeof(int) * tc.max_clients);

    config_free(&conf);
    memcpy(&conf, &tc, sizeof(struct config_t));
    return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[]) {
	int ret;

	config.logFilePath = DEFAULT_LOG_FILE_PATH;
	config.logLevel = INFO_LOG;

	parse_cmd_line(argc, argv);

	ret = load_config();
	if(ret) {
		log_message(ERROR_LOG, "Loading configuration failed.");
		config_free();
		return 1;
	}

	ret = initialize();
	if(ret != 0) {
		log_message(ERROR_LOG, "initialize is failed.");
		config_free();
		return 1;
	}

	ret = socks_proxy();

	cachemgr_fini();
	log_fini();
	config_free();

	return 0;
}
Exemplo n.º 3
0
int server_start()
{
    thread_state_t *state = NULL;

    struct sockaddr_in cli_addr;

    int cli_fd;
    socklen_t clilen = sizeof (cli_addr);


    /* Allocate new configuration */
    if ((server_config = config_new()) == NULL)
    {
        ERROR_MSG("Internal error: Can not allocate configuration\n");
        return 1;
    }

    /* Creating socket */
    if ((server_config->socket_fd = create_server_socket(get_port())) < 0)
    {
        ERROR_MSG("Error: Can not create socket\n");
        config_free(&server_config);
        return 1;
    }

    while (1)
    {
        cli_fd = accept(server_config->socket_fd, (struct sockaddr *)&cli_addr,
                        &clilen);

        if (cli_fd < 0)
        {
            ERROR_MSG("ERROR on accept\n");
            continue;
        }

        if (check_overload() < 0)
        {
            ERROR_MSG("ERROR close\n");
            close(cli_fd);
            continue;
        }

        state = thread_state_new();

        state->cli_fd = cli_fd;

        INCR_SERVER_LOAD;

        pthread_create(&(state->thread), NULL, compile_file, state);
    }

    config_free(&server_config);

    return 0;
}
Exemplo n.º 4
0
s32 ws__natpfHandWorkSyncSend(WS_ENV* soap, int *ret)
{
    CURL  *curl = NULL;
    struct hotb_config_s hotb_cfg;
    s8 url[256] = {0};
    s8 name[256]={0}, passwd[256]={0};
    CONFIG *cfg = NULL;
    int web_pro, web_port;
    char path[256]={0};
    char * sid = web_session_id();
    
    hotb_get_config(&hotb_cfg);

    
    sprintf(path, "/var/web/session/_%s", sid);
    if (NULL !=(cfg = config_load(path)))
    {
        strncpy(name,   config_get(cfg, "name", ""), 255);
        strncpy(passwd, config_get(cfg, "password", ""), 255);
        config_free(cfg); cfg = NULL;
    }

    cfg = config_load(CURRENT_WEB_PROTOCOL);
    web_pro = config_getint(cfg, "web_http_srv", 1);
    if(web_pro == 1)
    {
        web_port = config_getint(cfg, "web_http_port", 80);
        snprintf(url, 255, "http://%s:%d/func/web_main/submit/hotbackup/handworksync?user_name=%s&password=%s&get=1",  hotb_cfg.hotb_ip, web_port, name, passwd);
    }
    else
    {
        web_port = config_getint(cfg, "web_https_port", 443);
        snprintf(url, 255, "https://%s:%d/func/web_main/submit/hotbackup/handworksync?user_name=%s&password=%s&get=1", hotb_cfg.hotb_ip, web_port, name, passwd);
    }
    config_free(cfg);

    curl = curl_easy_init();
    if (NULL == curl)
    {
        return ws_send_soap_error(soap, "Failed before sending configures!");
    }
    curl_easy_setopt(curl, CURLOPT_URL, url);
    
    if (CURLE_OK != curl_easy_perform(curl))
    {
        curl_easy_cleanup(curl);
        return ws_send_soap_error(soap, "Failed on sending configures!");
    }
    DPF("path=[%s]\nurl=[%s]\n", path, url);
    curl_easy_cleanup(curl);

    return WS_OK;
}
Exemplo n.º 5
0
int main(int argc, const char **argv) {
	if (config_init(argc, argv))
		return 1;
	if (xlib_init()) {
		config_free();
		return 2;
	}
	xlib_mainloop();
	xlib_free(0);
	config_free();
	return 0;
}
Exemplo n.º 6
0
void
config_dereference (config_t * conf)
{
#ifdef WITH_DEBUG
	char szDebug[300];
#endif
	os_mutex_lock (&conf->lock);
	conf->refcount--;
	if (conf->refcount == 0) {
		config_free (conf);
		os_mutex_unlock (&conf->lock);

		/* Ok, this happens outside the lock.  But we know
		 * nothing is using it, so it can't hurt. */
		os_mutex_close (&conf->lock);
		free (conf);
#ifdef WITH_DEBUG
		sprintf (szDebug, "Last reference to config %p, now destroyed",
				 (void *) conf);
		DEBUG_LOG (szDebug);
#endif
	} else {
		os_mutex_unlock (&conf->lock);
	}
}
Exemplo n.º 7
0
/*******************************************************************************
 函数名称  : set_web_listen_global_conf
 功能描述  : 设置web监听全局配置
 输入参数  : global_conf   全局配置项
 输出参数  : 无
 返 回 值      : ERROR_SUCCESS  成功
                              ERROR_FAIL  失败
--------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :      仇俊杰
 修改目的   :      新添加函数
 修改日期   :      2011-1-8
*******************************************************************************/
u32 set_web_listen_global_conf (web_listen_global_cfg * global_conf)
{   
    CONFIG * cfg = NULL;
	s8 user_group_str[USER_GROUP_STRING_LEN] = {0};
    
    cfg = config_load(WEB_LISTEN_CFG_PATH);
    if (NULL == cfg)
    {
        return ERROR_FAIL;
    }
	strncpy(user_group_str, config_get(cfg, "user_group_string","1"), USER_GROUP_STRING_LEN - 1);
    user_group_str[USER_GROUP_STRING_LEN - 1] = 0;
    obj_quote_handle(user_group_str, NETADDR_DEL_REFER);
	
    cfg = config_setint(cfg, "set_enable", global_conf->enable);
    cfg = config_set(cfg, "user_group_string", global_conf->user_group);
    cfg = config_setint(cfg, "aged_time", global_conf->aged_time);
    cfg = config_set(cfg, "popwnd_url", global_conf->popwnd_url);
    cfg = config_setint(cfg, "pf_time", global_conf->pf_time);
 
	obj_quote_handle(global_conf->user_group, NETADDR_ADD_REFER);
	
    config_store(cfg, WEB_LISTEN_CFG_PATH);
    config_free(cfg);

     return ERROR_SUCCESS;
}
Exemplo n.º 8
0
static int
table_redis_update(void)
{
	struct config	*c;

	if ((c = config_load(conffile)) == NULL)
		return (0);
	if (config_connect(c) == 0) {
		config_free(c);
		return (0);
	}

	config_free(config);
	config = c;
	return (1);
}
Exemplo n.º 9
0
/* FIXME doc */
static int client_preprocess()
{
    if (preprocess(config->argc, config->argv))
    {
        config_free(&config);
        return -1;
    }

    if (send_argv(config->socket_fd, config->argc, config->argv) < 0)
    {
        ERROR_MSG("Error: Can not send argv to the server\n");
        close(config->socket_fd);

        return -1;
    }

    if (send_file(config->socket_fd, config->file->output_file) < 0)
    {
        ERROR_MSG("Error: Can not send file to the server\n");
        close(config->socket_fd);

        return -1;
    }

    return 0;
}
Exemplo n.º 10
0
void test_min_realizations_percent(const char * num_realizations_str, const char * min_realizations_str, int min_realizations){
  test_work_area_type * work_area = test_work_area_alloc("test_min_realizations");

  {
    FILE * config_file_stream = util_mkdir_fopen("config_file", "w");
    test_assert_not_NULL(config_file_stream);
    fprintf(config_file_stream, num_realizations_str);
    fprintf(config_file_stream, min_realizations_str);
    fclose(config_file_stream);

    config_type * c = config_alloc();
    config_schema_item_type * item = config_add_schema_item(c , NUM_REALIZATIONS_KEY , true );
    config_schema_item_set_default_type(item, CONFIG_INT);
    config_schema_item_set_argc_minmax( item , 1 , 1);
    item = config_add_schema_item(c , MIN_REALIZATIONS_KEY , false );
    config_schema_item_set_argc_minmax( item , 1 , 2);
    test_assert_true(config_parse(c , "config_file" , "--" , NULL , NULL , false , true ));

    analysis_config_type * ac = create_analysis_config( );
    analysis_config_init(ac, c);

    test_assert_int_equal( min_realizations , analysis_config_get_min_realisations( ac ) );

    analysis_config_free( ac );
    config_free( c );
  }

  test_work_area_free(work_area);
}
Exemplo n.º 11
0
TEST_F(ConfigTest, config_remove_section) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_TRUE(config_remove_section(config, "DID"));
  EXPECT_FALSE(config_has_section(config, "DID"));
  EXPECT_FALSE(config_has_key(config, "DID", "productId"));
  config_free(config);
}
Exemplo n.º 12
0
bool btc_config_init(void)
{
    osi_mutex_new(&lock);
    config = config_new(CONFIG_FILE_PATH);
    if (!config) {
        LOG_WARN("%s unable to load config file; starting unconfigured.\n", __func__);
        config = config_new_empty();
        if (!config) {
            LOG_ERROR("%s unable to allocate a config object.\n", __func__);
            goto error;
        }
    }
    if (config_save(config, CONFIG_FILE_PATH)) {
        // unlink(LEGACY_CONFIG_FILE_PATH);
    }

    return true;

error:;
    config_free(config);
    osi_mutex_free(&lock);
    config = NULL;
    LOG_ERROR("%s failed\n", __func__);
    return false;
}
Exemplo n.º 13
0
/*******************************************************************************
 函数名称  : ws__setDomainListenConfig
 功能描述  : 保存域监听的相关配置
 输入参数  : WS_ENV * ws_env  web services环境
                           int domainListenSwitch    域监听开关
                           int agedTime                  老化时间
 输出参数  : int *ret                          设置结果
 返 回 值     : 
                          WS_OK  成功
--------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者  : 张岳
 修改目的  : 新函数
 修改日期  : 2013年1月6日
*******************************************************************************/
s32 ws__setDomainListenConfig(WS_ENV* ws_env, int domainListenSwitch, int agedTime, int *ret)
{
	CONFIG *cfg = NULL;
	domain_listen_cfg listen_cfg;	
	u32 res = ERROR_SUCCESS;		

    cfg = config_load(DOMAIN_LISTEN_CFG_PATH);	
    if (NULL == cfg)
    {
        return ERROR_FAIL;
    }	

	/*域监听设置写入配置文件中*/
    cfg = config_setint(cfg, "switch", domainListenSwitch);      
    cfg = config_setint(cfg, "aged_time", agedTime);	
    config_store(cfg, DOMAIN_LISTEN_CFG_PATH);
    config_free(cfg);   
    
    listen_cfg.domain_listen_switch = domainListenSwitch;
    listen_cfg.aged_time = agedTime;
    /*下发到数据面*/	
    res = webauth_syscall_set_domain_listen_config(listen_cfg);
    if(ERROR_SUCCESS != res)
    {
        return ws_new_soap_fault(ws_env, ERROR_SYSTEM);
    }    

    *ret = 0;
    
    return WS_OK;
}
Exemplo n.º 14
0
int main(int argc, char **argv) {
    config_load(&config, argc, argv);
    for(int i = optind; i < argc; ++i) {
        printf("option: %s\n", argv[i]);
    }
    config_free(&config);
}
Exemplo n.º 15
0
void teardown(void)
{
	auth_disconnect();
	db_disconnect();
	config_free();
	g_mime_shutdown();
}
Exemplo n.º 16
0
TEST_F(ConfigTest, config_no_bad_keys) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_FALSE(config_has_key(config, "DID_BAD", "primaryRecord"));
  EXPECT_FALSE(config_has_key(config, "DID", "primaryRecord_BAD"));
  EXPECT_FALSE(config_has_key(config, CONFIG_DEFAULT_SECTION, "primaryRecord"));
  config_free(config);
}
Exemplo n.º 17
0
void teardown(void)
{
	auth_disconnect();
	db_disconnect();
	config_free();
	mempool_close(&queue_pool);
}
Exemplo n.º 18
0
/*******************************************************************************
 函数名称  : ws__getArpExploreInfo
 功能描述  : 获取ARP探测周期配置信息
 输入参数  : ws_env       ---- web service执行环境
 输出参数  : 无
 返 回 值  : WS_OK      ---- 执行成功
             soapFault  ---- 执行失败
--------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :      lishushu
 修改目的   :      新添加函数
 修改日期   :      2012-12-07
*******************************************************************************/
s32 ws__getArpExploreInfo(WS_ENV* ws_env, struct ws__getArpExploreInfoResponse *ret)
{
    CONFIG *cfg = config_load(CONPLAT_CONF"/arp_probes_conf.conf");
    
    (void)ws_env;
    ret->ret.openreqarp = 0;
    ret->ret.closearp = 0;
    ret->ret.oldtime = 600;
    ret->ret.retranstime = 5;
    ret->ret.explorecount = 6;
    ret->ret.vsmbondopt = 0;
    
    if (NULL != cfg)
    {
        ret->ret.openreqarp = config_getint(cfg, "close_req_arp_learning", ret->ret.openreqarp);
        ret->ret.closearp = config_getint(cfg,"close_arp", ret->ret.closearp);        
        ret->ret.oldtime = config_getint(cfg, "reachable_time", ret->ret.oldtime);
        ret->ret.retranstime = config_getint(cfg, "retrans_time", ret->ret.retranstime);
        ret->ret.explorecount = config_getint(cfg, "probes", ret->ret.explorecount);
        ret->ret.vsmbondopt = config_getint(cfg, "vsmbondopt", ret->ret.vsmbondopt);
    }
    config_free(cfg);

    return WS_OK;
}
Exemplo n.º 19
0
/*
 * This is the main global destructor for the app. Call this after
 * _all_ libcurl usage is done.
 */
static void main_free(struct GlobalConfig *config)
{
  /* Cleanup the easy handle */
  curl_easy_cleanup(config->easy);
  config->easy = NULL;

  /* Main cleanup */
  curl_global_cleanup();
  convert_cleanup();
  metalink_cleanup();
#ifdef USE_NSS
  if(PR_Initialized()) {
    /* prevent valgrind from reporting still reachable mem from NSRP arenas */
    PL_ArenaFinish();
    /* prevent valgrind from reporting possibly lost memory (fd cache, ...) */
    PR_Cleanup();
  }
#endif
  free_config_fields(config);

  /* Free the config structures */
  config_free(config->last);
  config->first = NULL;
  config->last = NULL;
}
Exemplo n.º 20
0
config_t *config_new(const char *filename)
{
    assert(filename != NULL);

    config_t *config = config_new_empty();
    if (!config) {
        return NULL;
    }

    esp_err_t err;
    nvs_handle fp;
    err = nvs_open(filename, NVS_READWRITE, &fp);
    if (err != ESP_OK) {
        if (err == ESP_ERR_NVS_NOT_INITIALIZED) {
            LOG_ERROR("%s: NVS not initialized. "
                      "Call nvs_flash_init before initializing bluetooth.", __func__);
        } else {
            LOG_ERROR("%s unable to open NVS namespace '%s'\n", __func__, filename);
        }
        config_free(config);
        return NULL;
    }

    config_parse(fp, config);
    nvs_close(fp);
    return config;
}
Exemplo n.º 21
0
/*****************************************************************************
 函 数 名      : ws__setLocalUserInfoSync
 功能描述  : 本地用户远程同步
 输入参数  : soap       ---- web service执行环境
 输出参数  : ret        ---- 返回结果
 返 回 值      : WS_OK      ---- 执行成功
 ----------------------------------------------------------------------------
----
 最近一次修改记录 :
 修改作者   : 仇俊杰
 修改目的   : 新添加函数
 修改日期   : 2011-2-22
*****************************************************************************/
int ws__setLocalUserInfoSync(WS_ENV * ws_env, char * umcIp, int umcPort, char * userInfo, int * ret)
{
	CONFIG *cfg;
	s8 *delim = "?";
	s8 send_umc[LOCAL_USER_SEND_UMC_LENGTH];
	s8 *user_info = NULL;
	s8 *user_info_tmp = NULL;	
	
	cfg = config_load(LOCAL_USER_CFG_PATH);
	if(NULL == cfg)
	{
		return ws_send_soap_error (ws_env, "Open file failed!");
	}
	cfg = config_set(cfg, "umc_ip", umcIp);
    cfg = config_setint(cfg, "umc_port", umcPort);
    config_store(cfg, LOCAL_USER_CFG_PATH);
    config_free(cfg);
	sprintf(send_umc, " curl http://%s:%d/UMC/sys/sub/OrgManageDevcieadd.action? --data-urlencode \"user=%s\"" , umcIp, 
	        umcPort, strtok(userInfo, delim));
	user_info = ws_malloc(ws_env, LOCAL_USER_INFO_LEN);
	user_info_tmp = ws_malloc(ws_env, LOCAL_USER_INFO_LEN);
	while((user_info = strtok(NULL, delim)))
	{ 
		sprintf(user_info_tmp, " --data-urlencode \"user=%s\"", user_info);
		strcat(send_umc, user_info_tmp);
	}	
	
	system(send_umc);
	return WS_OK;
}
Exemplo n.º 22
0
/*******************************************************************************
 函数名称  : portal_auth_set_basic_cfg
 功能描述  : 设置portal认证基本配置
 输入参数  : global_conf    ---- portal认证基本配置
 输出参数  : 无
 返 回 值      : PORTAL_SUCCESS: 成功
--------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   : 仇俊杰
 修改目的   : 新添加函数
 修改日期   : 2011-5-10
 *****************************************************************************/
u32 portal_set_basic_cfg (portal_basic_cfg_s * global_conf)
{
    CONFIG * cfg = NULL;

    cfg = config_load(PORTAL_AUTH_CFG_PATH);
    if (NULL == cfg)
    {
        return PORTAL_OPEN_FILE_FAIL;
    }
    cfg = config_setint(cfg, "webauth_switch", global_conf->webauth_switch);
    cfg = config_setint(cfg, "client_switch", global_conf->client_switch);
    cfg = config_setint(cfg, "aged_time", global_conf->aged_time);
    cfg = config_setint(cfg, "auth_method", global_conf->auth_method);
    cfg = config_setint(cfg, "unique_auth", global_conf->every_auth);
    cfg = config_setint(cfg, "q_offline", global_conf->q_offline);
    cfg = config_setint(cfg, "radius_acct", global_conf->radius_acct);
    cfg = config_setint(cfg, "heartbeat_time", global_conf->heartbeat_time);

    /*将基本配置写入文件*/
    config_store(cfg, PORTAL_AUTH_CFG_PATH);
    config_free(cfg);

    /*写入pam默认配置文件*/
    if (WEBAUTH_ENABLE == global_conf->webauth_switch || PORTAL_CLIENT_AUTH_ENABLE == global_conf->client_switch)
    {
        webauth_set_pam_config(global_conf->auth_method);
    }

    return PORTAL_SUCCESS;
}
Exemplo n.º 23
0
/*****************************************************************************
 函 数 名  : ws__setDnsmasq
 功能描述  : 防火墙设备:配置Dnsmasq
 输入参数  : ws_env         ---- web service执行环境
             dnsmasq        ---- 是否启用DNS代理:dnsmasq
 输出参数  : result         ---- 返回结果
 返 回 值  : ERR_OK         ---- 执行成功
             ws_new_soap_fault---- 执行失败
 -----------------------------------------------------------------------------
 最近一次修改记录:
 修改作者: zhangjiefeng
 修改目的: 生成新函数
 修改日期: 2010年01月19日
*****************************************************************************/
int ws__setDnsmasq(WS_ENV* ws_env, xsd__int dnsmasq, xsd__int* ret)
{
    s32 result = ERROR_SUCCESS;
    s8 *value = NULL;
    CONFIG * cfg = NULL;

    if(1 == dnsmasq)
    {
        result = startdnsmasq();
        value = "enable";
        if(ERROR_SUCCESS != result)
           return ws_send_soap_error(ws_env, "Start dnsmasq failed.");  
    }
    else if(0 == dnsmasq)
    {
        result = stopdnsmasq();
        value = "disable";
        if(ERROR_SUCCESS != result)
           return ws_send_soap_error(ws_env, "Stop dnsmasq failed.");
    }
    cfg = config_load(CFG_DNS_PATH);
    if(NULL == cfg)
    {
        return ws_send_soap_error(ws_env, "Open dns config file failed.");
    }
    cfg = config_setint(cfg, "dnsmasq_switch", dnsmasq);
    config_store(cfg, CFG_DNS_PATH);
    config_free(cfg);
    
    *ret = 0;
    return WS_OK;
}
Exemplo n.º 24
0
TEST_F(ConfigTest, config_remove_key_missing) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 0x1200);
  EXPECT_TRUE(config_remove_key(config, "DID", "productId"));
  EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 999);
  config_free(config);
}
Exemplo n.º 25
0
static int
wallet_save_keys(struct wallet *wallet)
{
   struct config *cfg;
   int res;
   int n;

   n = hashtable_getnumentries(wallet->hash_keys);

   Log(LGPFX" saving %u key%s in %sencrypted wallet %s.\n",
       n, n > 1 ? "s" : "",
       wallet->pass ? "encrypted" : "NON-",
       wallet->filename);

   cfg = config_create();
   config_setint64(cfg, n, "numKeys");

   if (wallet->pass) {
      char saltStr[80];
      int64 count = 0;
      bool s;

      res = RAND_bytes(wallet->ckey->salt, sizeof wallet->ckey->salt);
      if (res != 1) {
         res = ERR_get_error();
         Log(LGPFX" RAND_bytes failed: %d\n", res);
         goto exit;
      }
      str_snprintf_bytes(saltStr, sizeof saltStr, NULL,
                         wallet->ckey->salt, sizeof wallet->ckey->salt);
      config_setstring(cfg, saltStr, "encryption.salt");
      s = crypt_set_key_from_passphrase(wallet->pass, wallet->ckey, &count);
      ASSERT(s);
      ASSERT(count >= CRYPT_NUM_ITERATIONS_OLD);
      config_setint64(cfg, count, "encryption.numIterations");
   }

   hashtable_for_each(wallet->hash_keys, wallet_save_key_cb, cfg);

   file_rotate(wallet->filename, 1);
   res = file_create(wallet->filename);
   if (res) {
      Log(LGPFX" failed to create file '%s': %s\n",
          wallet->filename, strerror(res));
      goto exit;
   }
   res = file_chmod(wallet->filename, 0600);
   if (res) {
      Log(LGPFX" failed to chmod 0600 wallet.dat: %s\n",
          strerror(res));
      goto exit;
   }
   res = config_write(cfg, wallet->filename);

exit:
   config_free(cfg);

   return res;
}
Exemplo n.º 26
0
/* ARGSUSED */
static void
signal_terminate(int sig)
{

	detach_modes();
	config_free();
	exit(EXIT_SUCCESS);
}
Exemplo n.º 27
0
static void free_module(MODULE *mod)
{
	free(mod->instance);
	free(mod->file);
	config_free(mod->ini);
	if(mod->dlh) dlclose(mod->dlh);
	free(mod);
}
Exemplo n.º 28
0
TEST_F(ConfigTest, config_section_end) {
  config_t *config = config_new(CONFIG_FILE);
  const config_section_node_t * section = config_section_begin(config);
  section = config_section_next(section);
  section = config_section_next(section);
  EXPECT_EQ(section, config_section_end(config));
  config_free(config);
}
Exemplo n.º 29
0
static int
table_postgres_update(void)
{
	struct config	*c;

	if ((c = config_load(conffile)) == NULL)
		return 0;
	if (config_connect(c) == 0) {
		config_free(c);
		return 0;
	}

	config_free(config);
	config = c;

	return 1;
}
Exemplo n.º 30
0
TEST_F(ConfigTest, config_has_keys) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_TRUE(config_has_key(config, "DID", "recordNumber"));
  EXPECT_TRUE(config_has_key(config, "DID", "primaryRecord"));
  EXPECT_TRUE(config_has_key(config, "DID", "productId"));
  EXPECT_TRUE(config_has_key(config, "DID", "version"));
  config_free(config);
}