summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-09-10 14:20:27 +0200
committerJoas Schilling <coding@schilljs.com>2020-09-10 14:20:27 +0200
commitc25063dc0766f86aadcfa0ef87c1dfe1f758dc2b (patch)
treeb52779ab965630a8b4192c78231bb6a201144279 /lib/private
parentb056b5b7fcca028b57a38026de11890886bc4de1 (diff)
downloadnextcloud-server-c25063dc0766f86aadcfa0ef87c1dfe1f758dc2b.tar.gz
nextcloud-server-c25063dc0766f86aadcfa0ef87c1dfe1f758dc2b.zip
Don't break when the IP is empty
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Security/Bruteforce/Throttler.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php
index 7b98b3d8288..61e18088e94 100644
--- a/lib/private/Security/Bruteforce/Throttler.php
+++ b/lib/private/Security/Bruteforce/Throttler.php
@@ -227,6 +227,10 @@ class Throttler {
* @return int
*/
public function getAttempts(string $ip, string $action = '', float $maxAgeHours = 12): int {
+ if ($ip === '') {
+ return 0;
+ }
+
$ipAddress = new IpAddress($ip);
if ($this->isIPWhitelisted((string)$ipAddress)) {
return 0;