diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 5 | ||||
-rwxr-xr-x | src/etc/rc.update_urltables | 2 | ||||
-rwxr-xr-x | src/usr/local/www/firewall_aliases_edit.php | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index 71219fb..86f4a51 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -2150,7 +2150,7 @@ function pfs_version_compare($cur_time, $cur_text, $remote) { } return $v; } -function process_alias_urltable($name, $url, $freq, $forceupdate=false, $validateonly=false) { +function process_alias_urltable($name, $type, $url, $freq, $forceupdate=false, $validateonly=false) { global $g, $config; $urltable_prefix = "/var/db/aliastables/"; @@ -2177,7 +2177,8 @@ function process_alias_urltable($name, $url, $freq, $forceupdate=false, $validat if (download_file($url, $tmp_urltable_filename, $verify_ssl)) { // Convert lines that begin with '$' or ';' to comments '#' instead of deleting them. mwexec("/usr/bin/sed -i \"\" -E 's/^[[:space:]]*($|#|;)/#/g; /^#/!s/\;.*//g;' ". escapeshellarg($tmp_urltable_filename)); - if (alias_get_type($name) == "urltable_ports") { + $type = ($type) ? $type : alias_get_type($name); // If empty type passed, try to get it from config. + if ($type == "urltable_ports") { $ports = parse_aliases_file($tmp_urltable_filename, "url_ports", "-1", true); $ports = group_ports($ports, true); file_put_contents($urltable_filename, implode("\n", $ports)); diff --git a/src/etc/rc.update_urltables b/src/etc/rc.update_urltables index 887dfac..8a2c00b 100755 --- a/src/etc/rc.update_urltables +++ b/src/etc/rc.update_urltables @@ -49,7 +49,7 @@ if (count($todo) > 0) { continue; } - $r = process_alias_urltable($t['name'], $t['url'], $t['freq'], $forceupdate); + $r = process_alias_urltable($t['name'], $t['type'], $t['url'], $t['freq'], $forceupdate); if ($r == 1) { $result = ""; // TODO: Change it when pf supports tables with ports diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index f762fe8..ea60a73 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -206,6 +206,7 @@ if ($_POST) { $address = array(); $final_address_details = array(); $alias['name'] = $_POST['name']; + $alias['type'] = $_POST['type']; if (preg_match("/urltable/i", $_POST['type'])) { $address = ""; @@ -219,7 +220,7 @@ if ($_POST) { $alias['updatefreq'] = $_POST['address_subnet0'] ? $_POST['address_subnet0'] : 7; if (!is_URL($alias['url']) || empty($alias['url'])) { $input_errors[] = gettext("A valid URL must be provided."); - } elseif (!process_alias_urltable($alias['name'], $alias['url'], 0, true, true)) { + } elseif (!process_alias_urltable($alias['name'], $alias['type'], $alias['url'], 0, true, true)) { $input_errors[] = gettext("Unable to fetch usable data from URL") . " " . htmlspecialchars($alias['url']); } if ($_POST["detail0"] <> "") { |