summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2019-12-11 11:26:23 +0100
committerGitHub <noreply@github.com>2019-12-11 11:26:23 +0100
commit7f71e67765183bc340c2d9308c662932404512a9 (patch)
tree87986f089f365769e536f1a730baa346376e0c1a /lib
parentdb44cc859b91e9496e2d46760e474afc706a825c (diff)
parentf2d3e34c96ded153a095508f4dcd4fc76d9a9a8c (diff)
downloadnextcloud-server-7f71e67765183bc340c2d9308c662932404512a9.tar.gz
nextcloud-server-7f71e67765183bc340c2d9308c662932404512a9.zip
Merge pull request #18341 from kbucheli/handle_ipv6_address_with_explicit_interface
handle IPv6 addresses with an explict incoming interface at the end
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Security/Normalizer/IpAddress.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php
index 3bac6d8b103..8fb7b1003c4 100644
--- a/lib/private/Security/Normalizer/IpAddress.php
+++ b/lib/private/Security/Normalizer/IpAddress.php
@@ -75,6 +75,10 @@ class IpAddress {
if ($ip[0] === '[' && $ip[-1] === ']') { // If IP is with brackets, for example [::1]
$ip = substr($ip, 1, strlen($ip) - 2);
}
+ $pos = strpos($ip, '%'); // if there is an explicit interface added to the IP, e.g. fe80::ae2d:d1e7:fe1e:9a8d%enp2s0
+ if ($pos !== false) {
+ $ip = substr($ip, 0, $pos-1);
+ }
$binary = \inet_pton($ip);
for ($i = 128; $i > $maskBits; $i -= 8) {
$j = \intdiv($i, 8) - 1;