summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2021-04-08 14:48:27 +0200
committerGitHub <noreply@github.com>2021-04-08 14:48:27 +0200
commit2bedbc1793d65be0b688c5131a43c74a9f483012 (patch)
tree363c2d4edca95e0934880c9242241d6f242844d1
parent521a0b0ad35d3ae8c85dbe147b41d551885505ac (diff)
parente5a4236e686bfc97a69753b4a8e932b2f633de83 (diff)
downloadnextcloud-server-2bedbc1793d65be0b688c5131a43c74a9f483012.tar.gz
nextcloud-server-2bedbc1793d65be0b688c5131a43c74a9f483012.zip
Merge pull request #26439 from nextcloud/increase-subnet-matcher
Increase subnet matcher
-rw-r--r--lib/private/Security/Normalizer/IpAddress.php4
-rw-r--r--tests/lib/Security/Normalizer/IpAddressTest.php12
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php
index cbfc212e1ce..0a3606de28a 100644
--- a/lib/private/Security/Normalizer/IpAddress.php
+++ b/lib/private/Security/Normalizer/IpAddress.php
@@ -93,7 +93,7 @@ class IpAddress {
}
/**
- * Gets either the /32 (IPv4) or the /128 (IPv6) subnet of an IP address
+ * Gets either the /32 (IPv4) or the /64 (IPv6) subnet of an IP address
*
* @return string
*/
@@ -106,7 +106,7 @@ class IpAddress {
}
return $this->getIPv6Subnet(
$this->ip,
- 128
+ 64
);
}
diff --git a/tests/lib/Security/Normalizer/IpAddressTest.php b/tests/lib/Security/Normalizer/IpAddressTest.php
index 16be71cb225..044fc52b4b9 100644
--- a/tests/lib/Security/Normalizer/IpAddressTest.php
+++ b/tests/lib/Security/Normalizer/IpAddressTest.php
@@ -37,11 +37,19 @@ class IpAddressTest extends TestCase {
],
[
'2001:0db8:85a3:0000:0000:8a2e:0370:7334',
- '2001:db8:85a3::8a2e:370:7334/128',
+ '2001:db8:85a3::/64',
+ ],
+ [
+ '2001:db8:3333:4444:5555:6666:7777:8888',
+ '2001:db8:3333:4444::/64',
+ ],
+ [
+ '::1234:5678',
+ '::/64',
],
[
'[::1]',
- '::1/128',
+ '::/64',
],
];
}