mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Feature#1603. URL table aliases should be usable within network type aliases.
This commit is contained in:
parent
2ba6c4ab46
commit
ae660b3ce7
@ -452,6 +452,15 @@ function filter_generate_scrubing() {
|
||||
return $scrubrules;
|
||||
}
|
||||
|
||||
function get_alias_type($name) {
|
||||
global $config;
|
||||
|
||||
foreach ($config['aliases']['alias'] as $alias)
|
||||
if ($name == $alias['name'])
|
||||
return $alias['type'];
|
||||
return "";
|
||||
}
|
||||
|
||||
function filter_generate_nested_alias($name, $alias, &$aliasnesting, &$aliasaddrnesting) {
|
||||
global $aliastable, $filterdns;
|
||||
|
||||
@ -465,8 +474,18 @@ function filter_generate_nested_alias($name, $alias, &$aliasnesting, &$aliasaddr
|
||||
$linelength = strlen($builtlist);
|
||||
$tmpline = "";
|
||||
if(is_alias($address)) {
|
||||
if (get_alias_type($address) == 'urltable'){
|
||||
// Feature#1603. For this type of alias we do not need to recursively call filter_generate_nested_alias. Just load IPs from the file.
|
||||
$urlfn = alias_expand_urltable($address);
|
||||
if ($file_as_arr=file($urlfn)){
|
||||
foreach($file_as_arr as $line){
|
||||
$address= rtrim($line);
|
||||
$tmpline .= " $address";
|
||||
}
|
||||
}
|
||||
}
|
||||
/* We already expanded this alias so there is no neccessity to do it again. */
|
||||
if(!isset($aliasnesting[$address]))
|
||||
else if(!isset($aliasnesting[$address]))
|
||||
$tmpline = filter_generate_nested_alias($address, $aliastable[$address], $aliasnesting, $aliasaddrnesting);
|
||||
} else if(!isset($aliasaddrnesting[$address])) {
|
||||
if(!is_ipaddr($address) && !is_subnet($address) && !is_port($address)) {
|
||||
|
||||
@ -252,7 +252,10 @@ if ($_POST) {
|
||||
if($_POST["address{$x}"] <> "") {
|
||||
if (is_alias($_POST["address{$x}"])) {
|
||||
if (!alias_same_type($_POST["address{$x}"], $_POST['type']))
|
||||
$wrongaliases .= " " . $_POST["address{$x}"];
|
||||
// But alias type network can include alias type urltable. Feature#1603.
|
||||
if (!($_POST['type'] == 'network' &&
|
||||
get_alias_type($_POST["address{$x}"]) == 'urltable'))
|
||||
$wrongaliases .= " " . $_POST["address{$x}"];
|
||||
} else if ($_POST['type'] == "port") {
|
||||
if (!is_port($_POST["address{$x}"]))
|
||||
$input_errors[] = $_POST["address{$x}"] . " " . gettext("is not a valid port or alias.");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user