diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-06-30 10:47:11 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-06-30 10:47:11 -0300 |
commit | 939f4e39278d8acc1709bae76f51ec6551091fec (patch) | |
tree | 379f2cf8f94159dc4fb427fb2fbca30c044668e5 /etc/inc/filter_log.inc | |
parent | 0ffc4a7bc1c85db3f450aba1c12ed808a94411bc (diff) | |
download | pfsense-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
Diffstat (limited to 'etc/inc/filter_log.inc')
-rw-r--r-- | etc/inc/filter_log.inc | 32 |
1 files changed, 17 insertions, 15 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; } |