From 53b798233283707312f7830dbfcdded19e7fe0fa Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 8 Mar 2016 19:46:07 +1000 Subject: [PATCH] * jail.[ch]: misc fixes --- src/jail.c | 4 +++- src/jail.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jail.c b/src/jail.c index 81bbd1d..50b4af1 100644 --- a/src/jail.c +++ b/src/jail.c @@ -40,7 +40,7 @@ f2b_jail_apply_config(f2b_jail_t *jail, f2b_config_section_t *section) { assert(jail != NULL); assert(section != NULL); - assert(section->type != t_jail || section->type == t_defaults); + assert(section->type == t_jail || section->type == t_defaults); for (param = section->param; param != NULL; param = param->next) { if (strcmp(param->name, "enabled") == 0) { @@ -127,6 +127,7 @@ f2b_jail_create(f2b_config_section_t *section) { f2b_jail_t *jail = NULL; assert(section != NULL); + assert(section->type == t_jail); if ((jail = calloc(1, sizeof(f2b_jail_t))) == NULL) { f2b_log_msg(log_error, "calloc() for new jail failed"); @@ -134,6 +135,7 @@ f2b_jail_create(f2b_config_section_t *section) { } memcpy(jail, &defaults, sizeof(f2b_jail_t)); + strncpy(jail->name, section->name, sizeof(jail->name)); f2b_jail_apply_config(jail, section); return jail; diff --git a/src/jail.h b/src/jail.h index b2d0c7a..47d7740 100644 --- a/src/jail.h +++ b/src/jail.h @@ -10,6 +10,7 @@ #include "filelist.h" typedef struct f2b_jail_t { + struct f2b_jail_t *next; bool enabled; time_t bantime; size_t tries;