Browse Source

* jail.[ch]: misc fixes

master
Alex 'AdUser' Z 8 years ago
parent
commit
53b7982332
  1. 4
      src/jail.c
  2. 1
      src/jail.h

4
src/jail.c

@ -40,7 +40,7 @@ f2b_jail_apply_config(f2b_jail_t *jail, f2b_config_section_t *section) {
assert(jail != NULL); assert(jail != NULL);
assert(section != 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) { for (param = section->param; param != NULL; param = param->next) {
if (strcmp(param->name, "enabled") == 0) { if (strcmp(param->name, "enabled") == 0) {
@ -127,6 +127,7 @@ f2b_jail_create(f2b_config_section_t *section) {
f2b_jail_t *jail = NULL; f2b_jail_t *jail = NULL;
assert(section != NULL); assert(section != NULL);
assert(section->type == t_jail);
if ((jail = calloc(1, sizeof(f2b_jail_t))) == NULL) { if ((jail = calloc(1, sizeof(f2b_jail_t))) == NULL) {
f2b_log_msg(log_error, "calloc() for new jail failed"); 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)); memcpy(jail, &defaults, sizeof(f2b_jail_t));
strncpy(jail->name, section->name, sizeof(jail->name));
f2b_jail_apply_config(jail, section); f2b_jail_apply_config(jail, section);
return jail; return jail;

1
src/jail.h

@ -10,6 +10,7 @@
#include "filelist.h" #include "filelist.h"
typedef struct f2b_jail_t { typedef struct f2b_jail_t {
struct f2b_jail_t *next;
bool enabled; bool enabled;
time_t bantime; time_t bantime;
size_t tries; size_t tries;

Loading…
Cancel
Save