From be61b318d87e8f47ca2a8a97569336d89433c618 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 21 Jul 2015 13:54:54 +0000 Subject: [PATCH] (legacy) remove a lot of dependencies in authgui.inc by replacing the ip lookup --- src/etc/inc/authgui.inc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc index dda2408b7..03fe941f5 100644 --- a/src/etc/inc/authgui.inc +++ b/src/etc/inc/authgui.inc @@ -398,7 +398,6 @@ function display_login_form() /* Check against locally configured IP addresses, which will catch when someone port forwards WebGUI access from WAN to an internal IP on the router. */ - $FilterIflist = filter_generate_optcfg_array() ; $local_ip = false; if (strstr($_SERVER['HTTP_HOST'], ":")) { $http_host_port = explode(":", $_SERVER['HTTP_HOST']); @@ -406,13 +405,19 @@ function display_login_form() } else { $http_host = $_SERVER['HTTP_HOST']; } - foreach ($FilterIflist as $iflist) { - if ($iflist['ip'] == $http_host) { - $local_ip = true; - } - if ($iflist['ipv6'] == $http_host) { - $local_ip = true; - } + + // fix, local ip check was previously done using "filter_generate_optcfg_array" which basically includes alomst everything here. + // this should do the trick as well. + if (isset($config['interfaces'])) { + foreach($config['interfaces'] as $if => $ifdetail) { + if (isset($ifdetail['enable'])) { + if (isset($ifdetail['ipaddr']) && $ifdetail['ipaddr'] == $http_host) { + $local_ip = true; + } elseif (isset($ifdetail['ipaddr6']) && $ifdetail['ipaddr6'] == $http_host) { + $local_ip = true; + } + } + } } if (isset($config['virtualip'])) {