summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-06-30 10:47:11 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-06-30 10:47:11 -0300
commit939f4e39278d8acc1709bae76f51ec6551091fec (patch)
tree379f2cf8f94159dc4fb427fb2fbca30c044668e5
parent0ffc4a7bc1c85db3f450aba1c12ed808a94411bc (diff)
downloadpfsense-939f4e39278d8acc1709bae76f51ec6551091fec.zip
pfsense-939f4e39278d8acc1709bae76f51ec6551091fec.tar.gz
Fix #3725:
- Fix match_filter_field() and also simplify logic - Fix $filterfieldsarray initialization - Avoid to have double spaces on filterfieldsarray['act'] - Fix filter on Firewall Logs
-rw-r--r--etc/inc/filter_log.inc32
-rw-r--r--usr/local/www/diag_logs_filter.php6
2 files changed, 20 insertions, 18 deletions
diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc
index 6b3e279..8b1903e 100644
--- a/etc/inc/filter_log.inc
+++ b/etc/inc/filter_log.inc
@@ -95,28 +95,30 @@ function match_filter_line($flent, $filtertext = "") {
}
function match_filter_field($flent, $fields) {
- foreach ($fields as $field) {
- if ($fields[$field] == "All") continue;
- if ((strpos($fields[$field], '!') === 0)) {
- $fields[$field] = substr($fields[$field], 1);
- if (preg_match("/act/i", $field)) {
- if ( (in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
+ foreach ($fields as $key => $field) {
+ if ($field == "All")
+ continue;
+ if ((strpos($$field, '!') === 0)) {
+ $field = substr($field, 1);
+ if (strtolower($key) == 'act') {
+ if (in_arrayi($flent[$key], explode(" ", $field)))
+ return false;
} else {
- $field_regex = escape_filter_regex($fields[$field]);
- if ( (@preg_match("/{$field_regex}/i", $flent[$field])) )
+ $field_regex = escape_filter_regex($field);
+ if (@preg_match("/{$field_regex}/i", $flent[$key]))
return false;
}
- }
- else {
- if (preg_match("/act/i", $field)) {
- if ( !(in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
+ } else {
+ if (strtolower($key) == 'act') {
+ if (!in_arrayi($flent[$key], explode(" ", $field)))
+ return false;
} else {
- $field_regex = escape_filter_regex($fields[$field]);
- if ( !(@preg_match("/{$field_regex}/i", $flent[$field])) )
+ $field_regex = escape_filter_regex($field);
+ if (!@preg_match("/{$field_regex}/i", $flent[$key]))
return false;
}
}
- }
+ }
return true;
}
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index 13d72bd..d12ad43 100644
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -87,14 +87,14 @@ if ($filtersubmit) {
$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
if ($filterlogentries_submit) {
- $filterfieldsarray = array("act", "time", "interface", "srcip", "srcport", "dstip", "dstport", "proto", "tcpflags");
+ $filterfieldsarray = array();
$actpass = getGETPOSTsettingvalue('actpass', null);
$actblock = getGETPOSTsettingvalue('actblock', null);
$actreject = getGETPOSTsettingvalue('actreject', null);
- $filterfieldsarray['act'] = trim($actpass . " " . $actblock . " " . $actreject);
- $filterfieldsarray['act'] = $filterfieldsarray['act'] ? $filterfieldsarray['act'] : 'All';
+ $filterfieldsarray['act'] = str_replace(" ", " ", trim($actpass . " " . $actblock . " " . $actreject));
+ $filterfieldsarray['act'] = $filterfieldsarray['act'] != "" ? $filterfieldsarray['act'] : 'All';
$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
$filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null);
$filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null);
OpenPOWER on IntegriCloud