Browse Source

+ jail.[ch]: add f2b_jail_stop()

master
Alex 'AdUser' Z 9 years ago
parent
commit
88c8511a6b
  1. 25
      src/jail.c
  2. 3
      src/jail.h

25
src/jail.c

@ -283,3 +283,28 @@ f2b_jail_init(f2b_jail_t *jail, f2b_config_t *config) {
f2b_backend_destroy(jail->backend);
return false;
}
bool
f2b_jail_stop(f2b_jail_t *jail) {
bool errors = false;
f2b_filelist_destroy(jail->logfiles);
f2b_filter_destroy(jail->filter);
for (f2b_ipaddr_t *addr = jail->ipaddrs; addr != NULL; addr = addr->next) {
if (!addr->banned)
continue;
if (f2b_jail_unban(jail, addr))
continue;
errors = true;
}
f2b_addrlist_destroy(jail->ipaddrs);
if (!f2b_backend_stop(jail->backend)) {
f2b_log_msg(log_error, "jail '%s': action 'stop' failed: %s",
jail->name, f2b_backend_error(jail->backend));
errors = true;
}
return errors;
}

3
src/jail.h

@ -33,6 +33,7 @@ void f2b_jail_parse_compound_value(const char *value, char *name, char *init);
f2b_jail_t *f2b_jail_create (f2b_config_section_t *section);
void f2b_jail_set_defaults(f2b_config_section_t *section);
size_t f2b_jail_process (f2b_jail_t *jail);
bool f2b_jail_init (f2b_jail_t *jail, f2b_config_t *config);
size_t f2b_jail_process (f2b_jail_t *jail);
bool f2b_jail_stop (f2b_jail_t *jail);
#endif /* F2B_JAIL_H_ */

Loading…
Cancel
Save