Problem with Alias URL Lists.
-
Hi
I'm having an issue with creating a new Alias list based on multiple URLs. When going into Firewall -> Aliases -> URLs, and clicking Add. I can successfully create a new alias just fine, using the 'URLs (IPs)' option. I'm adding in 2 URLs, both of which work fine.
However...
pfSense seems to only import the last URL in the list into the Alias, and is ignoring any ones above the last one. I've even checked the contents of /cf/conf/config.xml and only see the IP's from the last most URL in the list within the Alias.
Am I doing something wrong? As it appears that even though it says I can enter as many URLs as I wish, it is only ever processing the last one. It also doesn't matter which order the URLs are in either.
Cheers
-
So from what I can seem the file `/usr/local/www/firewall_aliases_edit.php', when saving the URL list, isn't appending the $address array and is instead replacing it completely with the contents of the last processed URL (specifically line #293):
292 if (file_exists("{$temp_filename}/aliases")) { 293 $address = parse_aliases_file("{$temp_filename}/aliases", $_POST['type'], 5000); 294 if ($address == null) { 295 /* nothing was found */ 296 $input_errors[] = sprintf(gettext("A valid URL must be provided. Could not fetch usable data from '%s'."), $_POST['address' . $x]); 297 } 298 mwexec("/bin/rm -rf " . escapeshellarg($temp_filename)); 299 } else {
I've performed the following change, which appears to fix this. Admittedly it's not the cleanest fix, but it proves that this is an issue:
@@ -253,6 +253,7 @@ for ($x = 0; $x < $max_alias_addresses - 1; $x++) { $_POST['address' . $x] = trim($_POST['address' . $x]); if ($_POST['address' . $x]) { + $t_address = array(); /* fetch down and add in */ $temp_filename = tempnam("{$g['tmp_path']}/", "alias_import"); unlink_if_exists($temp_filename); @@ -290,10 +291,13 @@ } if (file_exists("{$temp_filename}/aliases")) { - $address = parse_aliases_file("{$temp_filename}/aliases", $_POST['type'], 5000); - if ($address == null) { + $t_address = parse_aliases_file("{$temp_filename}/aliases", $_POST['type'], 5000); + if ($t_address == null) { /* nothing was found */ $input_errors[] = sprintf(gettext("A valid URL must be provided. Could not fetch usable data from '%s'."), $_POST['address' . $x]); + } else { + $address += $t_address; } + unset($t_address); mwexec("/bin/rm -rf " . escapeshellarg($temp_filename)); } else { ``` mwexec("/bin/rm -rf " . escapeshellarg($temp_filename)); } else {
-
Log it in redmine and perhaps it will be fixed in 2.4.4_p1.
https://redmine.pfsense.org/projects/pfsense/issues?set_filter=1&tracker_id=1