Browse Source

ckdb - correct IPS removal and name the events trees

master
kanoi 9 years ago
parent
commit
332574564b
  1. 8
      src/ckdb.c
  2. 2
      src/ckdb.h
  3. 2
      src/ckdb_data.c

8
src/ckdb.c

@ -1259,10 +1259,10 @@ static void alloc_storage()
events_free = k_new_list("Events", sizeof(EVENTS), events_free = k_new_list("Events", sizeof(EVENTS),
ALLOC_EVENTS, LIMIT_EVENTS, true); ALLOC_EVENTS, LIMIT_EVENTS, true);
events_store = k_new_store(events_free); events_store = k_new_store(events_free);
events_user_root = new_ktree(NULL, cmp_events_user, events_free); events_user_root = new_ktree("EventsUser", cmp_events_user, events_free);
events_ip_root = new_ktree(NULL, cmp_events_ip, events_free); events_ip_root = new_ktree("EventsIP", cmp_events_ip, events_free);
events_ipc_root = new_ktree(NULL, cmp_events_ipc, events_free); events_ipc_root = new_ktree("EventsIPC", cmp_events_ipc, events_free);
events_hash_root = new_ktree(NULL, cmp_events_hash, events_free); events_hash_root = new_ktree("EventsHash", cmp_events_hash, events_free);
ovents_free = k_new_list("OKEvents", sizeof(OVENTS), ovents_free = k_new_list("OKEvents", sizeof(OVENTS),
ALLOC_OVENTS, LIMIT_OVENTS, true); ALLOC_OVENTS, LIMIT_OVENTS, true);

2
src/ckdb.h

@ -51,7 +51,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.4" #define DB_VERSION "1.0.4"
#define CKDB_VERSION DB_VERSION"-1.959" #define CKDB_VERSION DB_VERSION"-1.960"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__

2
src/ckdb_data.c

@ -4378,6 +4378,7 @@ bool _ok_ips(bool is_event, char *ip, char *eventname, tv_t *now)
} }
// The OK has expired, so remove it // The OK has expired, so remove it
prev_item = prev_in_ktree(ctx); prev_item = prev_in_ktree(ctx);
remove_from_ktree(ips_root, i_item);
k_unlink_item(ips_store, i_item); k_unlink_item(ips_store, i_item);
if (ips->description) { if (ips->description) {
LIST_MEM_SUB(ips_free, ips->description); LIST_MEM_SUB(ips_free, ips->description);
@ -4418,6 +4419,7 @@ bool banned_ips(char *ip, tv_t *now, bool *is_event)
} }
// The ban has expired, so remove it // The ban has expired, so remove it
prev_item = prev_in_ktree(ctx); prev_item = prev_in_ktree(ctx);
remove_from_ktree(ips_root, i_item);
k_unlink_item(ips_store, i_item); k_unlink_item(ips_store, i_item);
if (ips->description) { if (ips->description) {
LIST_MEM_SUB(ips_free, ips->description); LIST_MEM_SUB(ips_free, ips->description);

Loading…
Cancel
Save