summaryrefslogtreecommitdiffstats
path: root/lib/private/Security
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-12-01 18:01:22 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-12-01 20:29:47 +0000
commit761b5ac91e169c85c6ef61d992bb3a3bef39cded (patch)
treeb797ded7da30b655d11b1625042d79fbe1ccbc7a /lib/private/Security
parentb67c6d973069fb941219f68f871e5bb7237c1f00 (diff)
downloadnextcloud-server-761b5ac91e169c85c6ef61d992bb3a3bef39cded.tar.gz
nextcloud-server-761b5ac91e169c85c6ef61d992bb3a3bef39cded.zip
Don't query the bruteforce attempts when we just deleted them
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Security')
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index 6c898cdf7e6..fa4c58e4559 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -66,6 +66,8 @@ class Throttler {
private $logger;
/** @var IConfig */
private $config;
+ /** @var bool */
+ private $hasAttemptsDeleted = false;
/**
* @param IDBConnection $db
@@ -230,7 +232,7 @@ class Throttler {
$maxAgeHours = 48;
}
- if ($ip === '') {
+ if ($ip === '' || $this->hasAttemptsDeleted) {
return 0;
}
@@ -306,7 +308,9 @@ class Throttler {
->andWhere($qb->expr()->eq('action', $qb->createNamedParameter($action)))
->andWhere($qb->expr()->eq('metadata', $qb->createNamedParameter(json_encode($metadata))));
- $qb->execute();
+ $qb->executeStatement();
+
+ $this->hasAttemptsDeleted = true;
}
/**