Merge pull request #1 from stalks/develop

Catchup
master
stalks 2013-02-21 13:28:00 -08:00
commit 45aa6e504b
2 changed files with 3 additions and 3 deletions

View File

@ -52,8 +52,8 @@
// Reset repeat offender count after this number of seconds or // Reset repeat offender count after this number of seconds or
// multiply last ban period by <defense_repeat_multiplier>, whichever is greater // multiply last ban period by <defense_repeat_multiplier>, whichever is greater
$rcmail_config['defense_repeat_reset'] = 86400; $rcmail_config['defense_repeat_reset'] = 86400;
// Name of table in database // Name of table in database
$rcmail_config['defense_db_table'] = 'defense'; $rcmail_config['defense_db_table'] = 'defense';

View File

@ -131,7 +131,7 @@ class defense extends rcube_plugin {
return (((!preg_match('/^[\.\/:0-9a-f]+$/', strtolower($ip))) || (substr_count($ip, ':') < 2)) ? true : false); 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 * @param string
* ip address * ip address
@ -347,7 +347,7 @@ class defense extends rcube_plugin {
$this->debug($query . " [" . $result->rowCount() . "]"); $this->debug($query . " [" . $result->rowCount() . "]");
$row = $result->fetch(); $row = $result->fetch();
if (!$row) { $this->debug("Warning, SQL result empty: $query"); return false; } // No rows? Strange, abort. 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)) { if (($row['n'] >= $this->fail_max)) {
$this->debug("IP banned."); $this->debug("IP banned.");
// This IP is now banned // This IP is now banned