Révision 939f4e39
Ajouté par Renato Botelho il y a presque 10 ans
etc/inc/filter_log.inc | ||
---|---|---|
95 | 95 |
} |
96 | 96 |
|
97 | 97 |
function match_filter_field($flent, $fields) { |
98 |
foreach ($fields as $field) { |
|
99 |
if ($fields[$field] == "All") continue; |
|
100 |
if ((strpos($fields[$field], '!') === 0)) { |
|
101 |
$fields[$field] = substr($fields[$field], 1); |
|
102 |
if (preg_match("/act/i", $field)) { |
|
103 |
if ( (in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false; |
|
98 |
foreach ($fields as $key => $field) { |
|
99 |
if ($field == "All") |
|
100 |
continue; |
|
101 |
if ((strpos($$field, '!') === 0)) { |
|
102 |
$field = substr($field, 1); |
|
103 |
if (strtolower($key) == 'act') { |
|
104 |
if (in_arrayi($flent[$key], explode(" ", $field))) |
|
105 |
return false; |
|
104 | 106 |
} else { |
105 |
$field_regex = escape_filter_regex($fields[$field]);
|
|
106 |
if ( (@preg_match("/{$field_regex}/i", $flent[$field])) )
|
|
107 |
$field_regex = escape_filter_regex($field); |
|
108 |
if (@preg_match("/{$field_regex}/i", $flent[$key]))
|
|
107 | 109 |
return false; |
108 | 110 |
} |
109 |
} |
|
110 |
else {
|
|
111 |
if (preg_match("/act/i", $field)) {
|
|
112 |
if ( !(in_arrayi($flent[$field], explode(",", str_replace(" ", ",", $fields[$field]))) ) ) return false;
|
|
111 |
} else {
|
|
112 |
if (strtolower($key) == 'act') {
|
|
113 |
if (!in_arrayi($flent[$key], explode(" ", $field)))
|
|
114 |
return false;
|
|
113 | 115 |
} else { |
114 |
$field_regex = escape_filter_regex($fields[$field]);
|
|
115 |
if ( !(@preg_match("/{$field_regex}/i", $flent[$field])) )
|
|
116 |
$field_regex = escape_filter_regex($field); |
|
117 |
if (!@preg_match("/{$field_regex}/i", $flent[$key]))
|
|
116 | 118 |
return false; |
117 | 119 |
} |
118 | 120 |
} |
119 |
}
|
|
121 |
} |
|
120 | 122 |
return true; |
121 | 123 |
} |
122 | 124 |
|
usr/local/www/diag_logs_filter.php | ||
---|---|---|
87 | 87 |
|
88 | 88 |
$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null); |
89 | 89 |
if ($filterlogentries_submit) { |
90 |
$filterfieldsarray = array("act", "time", "interface", "srcip", "srcport", "dstip", "dstport", "proto", "tcpflags");
|
|
90 |
$filterfieldsarray = array(); |
|
91 | 91 |
|
92 | 92 |
$actpass = getGETPOSTsettingvalue('actpass', null); |
93 | 93 |
$actblock = getGETPOSTsettingvalue('actblock', null); |
94 | 94 |
$actreject = getGETPOSTsettingvalue('actreject', null); |
95 | 95 |
|
96 |
$filterfieldsarray['act'] = trim($actpass . " " . $actblock . " " . $actreject);
|
|
97 |
$filterfieldsarray['act'] = $filterfieldsarray['act'] ? $filterfieldsarray['act'] : 'All'; |
|
96 |
$filterfieldsarray['act'] = str_replace(" ", " ", trim($actpass . " " . $actblock . " " . $actreject));
|
|
97 |
$filterfieldsarray['act'] = $filterfieldsarray['act'] != "" ? $filterfieldsarray['act'] : 'All';
|
|
98 | 98 |
$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null); |
99 | 99 |
$filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null); |
100 | 100 |
$filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null); |
Formats disponibles : Unified diff
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