mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Check for local IPs nested in IPv6 as well
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
d0830432a7
commit
707b46bb01
1 changed files with 3 additions and 1 deletions
|
|
@ -52,7 +52,9 @@ class LocalAddressChecker {
|
|||
$delimiter = strrpos($ip, ':'); // Get last colon
|
||||
$ipv4Address = substr($ip, $delimiter + 1);
|
||||
|
||||
if (!filter_var($ipv4Address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
if (
|
||||
!filter_var($ipv4Address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) ||
|
||||
in_array($ipv4Address, $localIps, true)) {
|
||||
$this->logger->warning("Host $ip was not connected to because it violates local access rules");
|
||||
throw new LocalServerException('Host violates local access rules');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue