diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-06-30 10:57:19 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-06-30 10:57:19 -0300 |
commit | c69e813c8420f2db40fcbd2f418cae8553852d66 (patch) | |
tree | 43ee1f686544d373896662ba6eeb849eb0477d6c /etc/inc | |
parent | 6d74e3e97bb7d89ea1e8b6277978920a9cd55755 (diff) | |
download | pfsense-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
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/filter_log.inc | 34 |
1 files changed, 21 insertions, 13 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; } |