diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-03-06 10:34:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-06 10:34:02 +0100 |
commit | d004164fcc4dc887cae388e68f8ded3b4ea166ad (patch) | |
tree | eb1187ef647dc25f4908b6dfa77268e174813636 /lib/private/Security | |
parent | 58f6a777b1cad989cca01bda029d0a71e3c7d16c (diff) | |
parent | c9b588774bf57b0d0f9742b2ca32f2185c4317f1 (diff) | |
download | nextcloud-server-d004164fcc4dc887cae388e68f8ded3b4ea166ad.tar.gz nextcloud-server-d004164fcc4dc887cae388e68f8ded3b4ea166ad.zip |
Merge pull request #13327 from nextcloud/allow-bracket-notation-for-remove-ipv6-address
Allow bracket IPv6 address format inside IPAdress Normalizer
Diffstat (limited to 'lib/private/Security')
-rw-r--r-- | lib/private/Security/Normalizer/IpAddress.php | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php index 84c87054c76..4edf83eca5e 100644 --- a/lib/private/Security/Normalizer/IpAddress.php +++ b/lib/private/Security/Normalizer/IpAddress.php @@ -68,6 +68,9 @@ class IpAddress { * @return string */ private function getIPv6Subnet(string $ip, int $maskBits = 48): string { + if ($ip[0] === '[' && $ip[-1] === ']') { // If IP is with brackets, for example [::1] + $ip = substr($ip, 1, strlen($ip) - 2); + } $binary = \inet_pton($ip); for ($i = 128; $i > $maskBits; $i -= 8) { $j = \intdiv($i, 8) - 1; |