diff --git a/config.inc.php.dist b/config.inc.php.dist index daaa28f..c1c8803 100644 --- a/config.inc.php.dist +++ b/config.inc.php.dist @@ -52,8 +52,8 @@ // Reset repeat offender count after this number of seconds or // multiply last ban period by , whichever is greater - $rcmail_config['defense_repeat_reset'] = 86400; + // Name of table in database $rcmail_config['defense_db_table'] = 'defense'; diff --git a/defense.php b/defense.php index 512c046..1b1e496 100644 --- a/defense.php +++ b/defense.php @@ -131,7 +131,7 @@ class defense extends rcube_plugin { return (((!preg_match('/^[\.\/:0-9a-f]+$/', strtolower($ip))) || (substr_count($ip, ':') < 2)) ? true : false); } /** - * Check string if it is IPv6 + * Check string if it is IPv4 * * @param string * ip address @@ -347,7 +347,7 @@ class defense extends rcube_plugin { $this->debug($query . " [" . $result->rowCount() . "]"); $row = $result->fetch(); if (!$row) { $this->debug("Warning, SQL result empty: $query"); return false; } // No rows? Strange, abort. - $this->debug("Found " . $row['n'] . " failed attempts in last " . $this->fail_reset . "s"); + $this->debug("Found " . $row['n'] . " failed attempts in last " . (time() - $rTime) . "s"); if (($row['n'] >= $this->fail_max)) { $this->debug("IP banned."); // This IP is now banned