Commit 1df84c3e authored by Ad Schellevis's avatar Ad Schellevis

(filter) ditch alias_get_type()

parent 91de2057
...@@ -46,7 +46,7 @@ function alias_expand_urltable($name) { ...@@ -46,7 +46,7 @@ function alias_expand_urltable($name) {
if (preg_match("/urltable/i", $alias['type']) && ($alias['name'] == $name)) { if (preg_match("/urltable/i", $alias['type']) && ($alias['name'] == $name)) {
if (is_URL($alias["url"]) && file_exists($urltable_filename) && filesize($urltable_filename)) { if (is_URL($alias["url"]) && file_exists($urltable_filename) && filesize($urltable_filename)) {
return $urltable_filename; return $urltable_filename;
} elseif (process_alias_urltable($name, $alias["url"], 0, true)) { } elseif (process_alias_urltable($name, $alias["type"], $alias["url"], 0, true)) {
return $urltable_filename; return $urltable_filename;
} }
} elseif ($alias['type'] == 'geoip' && $alias['name'] == $name) { } elseif ($alias['type'] == 'geoip' && $alias['name'] == $name) {
...@@ -185,7 +185,7 @@ function update_alias_names_upon_change($section, $field, $new_alias_name, $orig ...@@ -185,7 +185,7 @@ function update_alias_names_upon_change($section, $field, $new_alias_name, $orig
} }
} }
function process_alias_urltable($name, $url, $freq, $forceupdate = false) function process_alias_urltable($name, $alias_type, $url, $freq, $forceupdate = false)
{ {
global $config; global $config;
...@@ -211,7 +211,6 @@ function process_alias_urltable($name, $url, $freq, $forceupdate = false) ...@@ -211,7 +211,6 @@ function process_alias_urltable($name, $url, $freq, $forceupdate = false)
// todo: rethink alias_expand_urltable in filter.inc , its probably not a very good idea to download and // todo: rethink alias_expand_urltable in filter.inc , its probably not a very good idea to download and
// process files during boot. // process files during boot.
$output_file_handle = fopen($urltable_filename, 'w'); $output_file_handle = fopen($urltable_filename, 'w');
$alias_type = alias_get_type($name);
// Try to fetch the URL supplied // Try to fetch the URL supplied
@unlink("{$urltable_filename}.tmp"); @unlink("{$urltable_filename}.tmp");
$verify_ssl = isset($config['system']['checkaliasesurlcert']); $verify_ssl = isset($config['system']['checkaliasesurlcert']);
......
...@@ -1088,21 +1088,6 @@ function is_alias($name) ...@@ -1088,21 +1088,6 @@ function is_alias($name)
return array_key_exists($name, $aliastable); return array_key_exists($name, $aliastable);
} }
function alias_get_type($name)
{
global $config;
if (is_array($config['aliases']['alias'])) {
foreach ($config['aliases']['alias'] as $alias) {
if ($name == $alias['name']) {
return $alias['type'];
}
}
}
return "";
}
/* expand a host or network alias, if necessary */ /* expand a host or network alias, if necessary */
function alias_expand($name) function alias_expand($name)
{ {
......
...@@ -36,7 +36,7 @@ if (count($todo) > 0) { ...@@ -36,7 +36,7 @@ if (count($todo) > 0) {
foreach ($todo as $alias) { foreach ($todo as $alias) {
if (preg_match('/urltable/i', $alias['type'])) { if (preg_match('/urltable/i', $alias['type'])) {
log_error("{$argv[0]}: start update {$alias['name']} "); log_error("{$argv[0]}: start update {$alias['name']} ");
$r = process_alias_urltable($alias['name'], $alias['url'], $alias['updatefreq']); $r = process_alias_urltable($alias['name'], $alias['type'], $alias['url'], $alias['updatefreq']);
if ($r == 1) { if ($r == 1) {
if ($alias['type'] == "urltable") { if ($alias['type'] == "urltable") {
exec("/sbin/pfctl -t " . escapeshellarg($alias['name']) . " -T replace -f /var/db/aliastables/" . escapeshellarg($alias['name']) . ".txt 2>&1", $result); exec("/sbin/pfctl -t " . escapeshellarg($alias['name']) . " -T replace -f /var/db/aliastables/" . escapeshellarg($alias['name']) . ".txt 2>&1", $result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment