mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Fix the referrer checks for IPv6 addresses Ticket #1583
This commit is contained in:
parent
4cf79fdd9b
commit
e6f7e0be56
@ -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;
|
||||
|
||||
@ -743,6 +743,28 @@ function get_configured_ip_addresses() {
|
||||
return $ip_array;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_configured_ipv6_addresses() - Return a list of all configured
|
||||
* interfaces IPv6 Addresses
|
||||
*
|
||||
*/
|
||||
function get_configured_ipv6_addresses() {
|
||||
require_once("interfaces.inc");
|
||||
$ipv6_array = array();
|
||||
$interfaces = get_configured_interface_list();
|
||||
if(is_array($interfaces)) {
|
||||
foreach($interfaces as $int) {
|
||||
$ipaddrv6 = get_interface_ipv6($int);
|
||||
$ipv6_array[$int] = $ipaddrv6;
|
||||
}
|
||||
}
|
||||
$interfaces = get_configured_carp_interface_list();
|
||||
if(is_array($interfaces))
|
||||
foreach($interfaces as $int => $ipaddrv6)
|
||||
$ipv6_array[$int] = $ipaddrv6;
|
||||
return $ipv6_array;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_interface_list() - Return a list of all physical interfaces
|
||||
* along with MAC and status.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user