From 464a3590fa9722b03cb4144cf400ca6fe6b4d611 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 21 Sep 2016 16:58:53 +1000 Subject: [PATCH] * simplify usage of backend test util --- src/backend-test.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/backend-test.c b/src/backend-test.c index 2d804bf..fca8e0d 100644 --- a/src/backend-test.c +++ b/src/backend-test.c @@ -17,7 +17,6 @@ void usage() { int main(int argc, char *argv[]) { const char *ip = "127.0.0.17"; f2b_config_t config; - f2b_config_param_t *param = NULL; f2b_config_section_t *section = NULL; f2b_backend_t *backend = NULL; @@ -30,23 +29,15 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - if ((section = f2b_config_section_find(config.jails, "test")) == NULL) { - f2b_log_msg(log_error, "can't find config section for jail 'test'"); - return EXIT_FAILURE; - } - - if ((param = f2b_config_param_find(section->param, "backend")) == NULL) { - f2b_log_msg(log_error, "jail 'test' has not param named 'backend'"); - return EXIT_FAILURE; - } - - if ((section = f2b_config_section_find(config.backends, param->value)) == NULL) { - f2b_log_msg(log_error, "can't find config section for backend '%s'", param->value); + if (config.backends == NULL) { + f2b_log_msg(log_error, "nos backend found in config"); return EXIT_FAILURE; + } else { + section = config.backends; } if ((backend = f2b_backend_create(section, argv[2])) == NULL) { - f2b_log_msg(log_error, "can't create backend '%s' with id '%s'", param->value, argv[2]); + f2b_log_msg(log_error, "can't create backend '%s' with id '%s'", section->name, argv[2]); return EXIT_FAILURE; }