From e6f7e0be56b8b2ea643cefb477a6ffe15380cdbb Mon Sep 17 00:00:00 2001 From: smos Date: Sun, 21 Aug 2011 13:13:11 +0200 Subject: Fix the referrer checks for IPv6 addresses Ticket #1583 --- etc/inc/auth.inc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'etc/inc/auth.inc') diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 7ad5291..b551be0 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -117,6 +117,7 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui'][' } $found_host = false; $referrer_host = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); + $referrer_host = str_replace(array("[", "]"), "", $referrer_host); if($referrer_host) { if(strcasecmp($referrer_host, $config['system']['hostname'] . "." . $config['system']['domain']) == 0 || strcasecmp($referrer_host, $config['system']['hostname']) == 0) @@ -138,6 +139,13 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui'][' break; } } + $interface_list_ipv6s = get_configured_ipv6_addresses(); + foreach($interface_list_ipv6s as $ilipv6s) { + if(strcasecmp($referrer_host, $ilipv6s) == 0) { + $found_host = true; + break; + } + } if($referrer_host == "127.0.0.1" || $referrer_host == "localhost") { // allow SSH port forwarded connections and links from localhost $found_host = true; -- cgit v1.1