Index: packetbl.c ================================================================== --- packetbl.c +++ packetbl.c @@ -811,17 +811,18 @@ * it should only be called during start-up and not from the main loop. * */ void parse_config(void) { - config_t *config = NULL; + config_t cf, *config; config_setting_t *config_setting = NULL; struct ce *config_entry = NULL; int result = 0; int i = 0; const char *facstr = NULL; + config = &cf; config_init(config); result = config_read_file(config, "test.config"); if (result == CONFIG_FALSE) { if (config_error_type(config) == CONFIG_ERR_PARSE) { fprintf (stderr, "Error parsing config file %s, line %d: %s\n", @@ -858,18 +859,20 @@ packet_cache_len = USE_CACHE_DEF_LEN; fprintf(stderr, "config size TTL negative - using default"); } #endif - config_lookup_string(config, "log.facility", &facstr); + result = config_lookup_string(config, "log.facility", &facstr); i = 0; - while (&facenum[i] != NULL) { - if (strcasecmp(facenum[i].string, facstr) == 0) { - conf.log_facility = facenum[i].num; - break; - } else { - i++; + if (result == CONFIG_TRUE) { + while (&facenum[i] != NULL) { + if (strcasecmp(facenum[i].string, facstr) == 0) { + conf.log_facility = facenum[i].num; + break; + } else { + i++; + } } } config_lookup_int(config, "config.queueno", &conf.queueno); @@ -877,18 +880,25 @@ conf.queueno = 1; fprintf(stderr, "queueno negative - using default"); } config_setting = config_lookup(config, "blacklistbl"); - parse_config_bl_list(config_setting, 1); + if (config_setting != NULL) { + parse_config_bl_list(config_setting, 1); + } config_setting = config_lookup(config, "whitelistbl"); - parse_config_bl_list(config_setting, 2); + if (config_setting != NULL) { + parse_config_bl_list(config_setting, 2); + } config_setting = config_lookup(config, "blacklist"); - parse_config_bl_list(config_setting, 3); + if (config_setting != NULL) { + parse_config_bl_list(config_setting, 3); + } config_setting = config_lookup(config, "whitelist"); - parse_config_bl_list(config_setting, 4); - + if (config_setting != NULL) { + parse_config_bl_list(config_setting, 4); + } } parse_config_bl_list(config_setting_t *c, int type) { struct config_entry *ce, *tmp;