diff options
author | Georg Ehrke <developer@georgehrke.com> | 2019-12-12 10:05:36 +0100 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2019-12-12 10:06:05 +0000 |
commit | f2551e53fb993dcba77df13d740349b4c1c19b7c (patch) | |
tree | 6aa0b002912c4bd8826e23b25a32b67ad0bead6c /apps | |
parent | 387d216214ef806eec1192ebc6ceebd7f3e039db (diff) | |
download | nextcloud-server-f2551e53fb993dcba77df13d740349b4c1c19b7c.tar.gz nextcloud-server-f2551e53fb993dcba77df13d740349b4c1c19b7c.zip |
Support more IPv6 addresses in the RefreshWebcalJob
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/BackgroundJob/RefreshWebcalJob.php | 11 | ||||
-rw-r--r-- | apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php index e99cd7038f6..4c1f12f63ea 100644 --- a/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php +++ b/apps/dav/lib/BackgroundJob/RefreshWebcalJob.php @@ -247,6 +247,17 @@ class RefreshWebcalJob extends Job { $this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules"); return null; } + + // Also check for IPv6 IPv4 nesting, because that's not covered by filter_var + if ((bool)filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && substr_count($host, '.') > 0) { + $delimiter = strrpos($host, ':'); // Get last colon + $ipv4Address = substr($host, $delimiter + 1); + + if (!filter_var($ipv4Address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { + $this->logger->warning("Subscription $subscriptionId was not refreshed because it violates local access rules"); + return null; + } + } } try { diff --git a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php index 8e24fb1f638..3490efa92f8 100644 --- a/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php +++ b/apps/dav/tests/unit/BackgroundJob/RefreshWebcalJobTest.php @@ -239,6 +239,8 @@ class RefreshWebcalJobTest extends TestCase { ['172.16.42.1'], ['[fdf8:f53b:82e4::53]/secret.ics'], ['[fe80::200:5aee:feaa:20a2]/secret.ics'], + ['[0:0:0:0:0:0:10.0.0.1]/secret.ics'], + ['[0:0:0:0:0:ffff:127.0.0.0]/secret.ics'], ['10.0.0.1'], ['another-host.local'], ['service.localhost'], |