From fbc37b91a81d3fad0fb4924b55526828d06ec513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Sat, 4 Jun 2022 23:32:11 +0200 Subject: [PATCH] Do not use IPvX from setupVars in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- scripts/pi-hole/php/auth.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/pi-hole/php/auth.php b/scripts/pi-hole/php/auth.php index 8bbf8342..993b057b 100644 --- a/scripts/pi-hole/php/auth.php +++ b/scripts/pi-hole/php/auth.php @@ -30,14 +30,11 @@ function log_and_die($message) { } function check_cors() { - $setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); - $ipv4 = isset($setupVars["IPV4_ADDRESS"]) ? explode("/", $setupVars["IPV4_ADDRESS"])[0] : $_SERVER['SERVER_ADDR']; - $ipv6 = isset($setupVars["IPV6_ADDRESS"]) ? explode("/", $setupVars["IPV6_ADDRESS"])[0] : $_SERVER['SERVER_ADDR']; + $ip = $_SERVER['SERVER_ADDR']; // Check CORS $AUTHORIZED_HOSTNAMES = array( - $ipv4, - $ipv6, + $ip, str_replace(array("[","]"), array("",""), $_SERVER["SERVER_NAME"]), "pi.hole", "localhost"