Skip to content

Commit

Permalink
Added calling COM_updateSpeedcheck after calling COM_checkSpeedlimit
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Apr 16, 2022
1 parent f0a050d commit 614453d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
9 changes: 7 additions & 2 deletions public_html/admin/auth.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@

// MAIN
COM_clearSpeedlimit($_CONF['login_speedlimit'], 'login');
if (COM_checkSpeedlimit('login', $_CONF['login_attempts']) > 0) {
$ipAddress = \Geeklog\IP::getIPAddress();

if (COM_checkSpeedlimit('login', $_CONF['login_attempts'], $ipAddress) > 0) {
COM_clearSpeedlimit(SPEED_LIMIT_WINDOW_ERROR_403, 'error-403');
COM_checkSpeedlimit('error-403', SPEED_LIMIT_MAX_ERROR_403);
COM_checkSpeedlimit('error-403', SPEED_LIMIT_MAX_ERROR_403, $ipAddress, $isSpeeding);
if (!$isSpeeding) {
COM_updateSpeedlimit('error-403', $ipAddress);
}

COM_displayMessageAndAbort(82, '', 403, 'Access denied');
}
Expand Down
6 changes: 5 additions & 1 deletion public_html/lib-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -8304,8 +8304,12 @@ function COM_handle404($alternate_url = '')
{
global $_CONF, $_USER, $LANG_404;

$ipAddress = \Geeklog\IP::getIPAddress();
COM_clearSpeedlimit(SPEED_LIMIT_WINDOW_ERROR_404, 'error-404');
COM_checkSpeedlimit('error-404', SPEED_LIMIT_MAX_ERROR_404);
COM_checkSpeedlimit('error-404', SPEED_LIMIT_MAX_ERROR_404, $ipAddress, $isSpeeding);
if (!$isSpeeding) {
COM_updateSpeedlimit('error-404', $ipAddress);
}

if (function_exists('CUSTOM_handle404')) {
CUSTOM_handle404($alternate_url);
Expand Down
6 changes: 5 additions & 1 deletion system/lib-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -2442,8 +2442,12 @@ function PLG_checkForSpam($comment, $action = -1, $permanentLink = null,
);

if ($result > PLG_SPAM_NOT_FOUND) { // Plugin found a match for spam
$ipAddress = \Geeklog\IP::getIPAddress();
COM_clearSpeedlimit(SPEED_LIMIT_WINDOW_ERROR_SPAM);
COM_checkSpeedlimit('error-spam', SPEED_LIMIT_MAX_ERROR_SPAM);
COM_checkSpeedlimit('error-spam', SPEED_LIMIT_MAX_ERROR_SPAM, $ipAddress, $isSpeeding);
if (!$isSpeeding) {
COM_updateSpeedlimit('error-spam', $ipAddress);
}

return PLG_spamAction($comment, $action);
}
Expand Down

0 comments on commit 614453d

Please sign in to comment.