summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-06-30 10:57:19 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-06-30 10:57:19 -0300
commitc69e813c8420f2db40fcbd2f418cae8553852d66 (patch)
tree43ee1f686544d373896662ba6eeb849eb0477d6c
parent6d74e3e97bb7d89ea1e8b6277978920a9cd55755 (diff)
downloadpfsense-c69e813c8420f2db40fcbd2f418cae8553852d66.zip
pfsense-c69e813c8420f2db40fcbd2f418cae8553852d66.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.inc34
-rwxr-xr-xusr/local/www/diag_logs_filter.php6
2 files changed, 24 insertions, 16 deletions
diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc
index c7ee997..4b1ba7a 100644
--- a/etc/inc/filter_log.inc
+++ b/etc/inc/filter_log.inc
@@ -90,20 +90,28 @@ 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;
- } else if ( (preg_match("/{$fields[$field]}/i", $flent[$field])) ) return false;
- }
- else {
- if (preg_match("/act/i", $field)) {
- if ( !(in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
- } else if ( !(preg_match("/{$fields[$field]}/i", $flent[$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 {
+ if (@preg_match("/{$field}/i", $flent[$key]))
+ return false;
+ }
+ } else {
+ if (strtolower($key) == 'act') {
+ if (!in_arrayi($flent[$key], explode(" ", $field)))
+ return false;
+ } else {
+ if (!@preg_match("/{$field}/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 48deb73..a212f5c 100755
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -73,14 +73,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