aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-09-10 16:11:06 +0200
committerGitHub <noreply@github.com>2020-09-10 16:11:06 +0200
commit3d61f7b258e3413fb112c6157fe172c7d29662be (patch)
treebfc21e148b7654cf9a6e79abaef6c1f949d1c413 /lib/private
parent40eabfb18134708f96c1fcbab4bad69f6b16780b (diff)
parentc25063dc0766f86aadcfa0ef87c1dfe1f758dc2b (diff)
downloadnextcloud-server-3d61f7b258e3413fb112c6157fe172c7d29662be.tar.gz
nextcloud-server-3d61f7b258e3413fb112c6157fe172c7d29662be.zip
Merge pull request #22774 from nextcloud/bugfix/noid/no-delay-without-ip
Don't break when the IP is empty
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;