2013-01-09 Hirofumi Kosaka <kosaka@rworks.jp>

* lib/PandoraFMS/SNMPServer.pm: Made sure SNMP filter is valid
	before performing string matching. It could make Pandora Server
	down at worst.  Merged from 4.0 branch.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7389 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2013-01-09 11:16:52 +00:00
parent 1effa7b63f
commit b872a94ad9
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2013-01-09 Hirofumi Kosaka <kosaka@rworks.jp>
* lib/PandoraFMS/SNMPServer.pm: Made sure SNMP filter is valid
before performing string matching. It could make Pandora Server
down at worst. Merged from 4.0 branch.
2013-01-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* lib/PandoraFMS/PredictionServer.pm: Fixed prediction modules.

View File

@ -239,6 +239,13 @@ sub matches_filter ($$$) {
my @filters = get_db_rows ($dbh, 'SELECT filter FROM tsnmp_filter');
foreach my $filter (@filters) {
my $regexp = safe_output($filter->{'filter'}) ;
# Check if $regexp begins with quantifier
if ($regexp =~ m/^[+*?]/ ) {
logger($pa_config, "Invalid SNMP filter. Quantifier follows nothing in regex '$regexp'.", 3);
next;
}
if ($string =~ m/$regexp/i) {
logger($pa_config, "Trap '$string' matches filter '$regexp'. Discarding...", 10);
return 1;