Browse Source

* f2b_jail_poll() : some code

master
Alex 'AdUser' Z 9 years ago
parent
commit
700b64b80e
  1. 25
      src/jail.c

25
src/jail.c

@ -55,17 +55,30 @@ f2b_jail_set_defaults(f2b_config_section_t *config) {
return; return;
} }
/*
size_t size_t
f2b_jail_poll(const jail_t *jail) { f2b_jail_poll(f2b_jail_t *jail) {
f2b_logfile_t *file = NULL;
f2b_ipaddr_t *addr = NULL;
size_t processed = 0; size_t processed = 0;
char logline[LOGLINE_MAX] = { '\0' }; char logline[LOGLINE_MAX] = "";
char matchbuf[IPADDR_MAX] = "";
for (f2b_logfile_t *file = jail->logfiles; file != NULL; file = file->next) { assert(jail != NULL);
if (f2b_logfile_getline(file, logline) < 0)
for (file = jail->logfiles; file != NULL; file = file->next) {
if (!f2b_logfile_getline(file, logline, sizeof(logline)))
continue;
if (!f2b_regexlist_match(jail->regexps, logline, matchbuf, sizeof(matchbuf)))
continue; continue;
addr = f2b_addrlist_lookup(jail->ipaddrs, matchbuf);
if (!addr) {
addr = f2b_ipaddr_create(matchbuf, jail->tries);
jail->ipaddrs = f2b_addrlist_append(jail->ipaddrs, addr);
/* TODO: log */
continue;
}
/* TODO: find & handle */
} }
return processed; return processed;
} }
*/

Loading…
Cancel
Save