diff --git a/src/plugin_blacklist.c b/src/plugin_blacklist.c index dad83b0..661e6d7 100644 --- a/src/plugin_blacklist.c +++ b/src/plugin_blacklist.c @@ -81,17 +81,17 @@ typedef struct { static sql_statement_t sql_statement[] = { /* blacklist_check() */ - { 0, NULL, "SELECT count(id) from blacklist WHERE ip=?001 and sipuri=?002 AND failcount>?003;" }, + { 0, NULL, "SELECT count(id) from blacklist WHERE ip=?001 and sipuri=?002 AND (type =1 or failcount>?003);" }, { 1, NULL, "UPDATE OR IGNORE blacklist SET lastseen=?003 WHERE ip=?001 and sipuri=?002;" }, { 2, NULL, "INSERT OR REPLACE INTO requests (timestamp, ip, sipuri, callid) VALUES (?001, ?002, ?003, ?004);" }, /* blacklist_update() */ { 3, NULL, "DELETE FROM requests WHERE timestamp 0) { DEBUGC(DBCLASS_BABBLE, "leaving blacklist_check, UAC is blocked"); + INFO ("UAC with IP %s [%s] is blocked", srcip, from); + osip_free(from); return STS_FAILURE; } + /* free resources */ + osip_free(from); + DEBUGC(DBCLASS_BABBLE, "leaving blacklist_check, UAC is permittet"); return STS_SUCCESS; } @@ -417,6 +419,7 @@ static int blacklist_update(sip_ticket_t *ticket) { return STS_SUCCESS; } + static int blacklist_expire(sip_ticket_t *ticket) { // int sts; // char *zErrMsg = NULL;