From: Stephen L Johnson Date: Fri, 15 Dec 2000 21:55:04 +0000 (+0000) Subject: added ^ direct to regexp matches instead of concat'ing to variable X-Git-Tag: spong-2_7_2~37 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21d1ad5452305d572c96a7c0625f9b489ec9c1b8;p=spong.git added ^ direct to regexp matches instead of concat'ing to variable --- diff --git a/src/spong-message.pl b/src/spong-message.pl index dea7ae5..56e49f0 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -12,7 +12,7 @@ # (2) Added rules based paging (Stephen Johnson Nov 14, 1998) # (3) Added checks against Acks and downtime (Stephen Johnson Mar 17, 1999) # -# $Id: spong-message.pl,v 1.16 2000/11/30 21:27:40 sljohnson Exp $ +# $Id: spong-message.pl,v 1.17 2000/12/15 21:55:04 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -336,8 +336,7 @@ RULE: if ( defined $rule->{'exclude_hosts'} ) { my($e); foreach $e ( @{$rule->{'exclude_hosts'}} ) { - $e = '^' . $e; - if ( $host =~ /$e/ ) { + if ( $host =~ /^$e/ ) { &debug("Match on exclude host $e on rule $c, going to next rule"); next RULE; } @@ -345,8 +344,7 @@ RULE: } if ( defined $rule->{'exclude_services'} ) { foreach $e ( @{$rule->{'exclude_services'}} ) { - $e = '^' . $e; - if ( $service =~ /$e/ ) { + if ( $service =~ /^$e/ ) { &debug("Match on exclude service $e on rule $c, going to next rule"); next RULE; } @@ -369,8 +367,7 @@ RULE: } else { $m = 0; foreach $e ( @{$rule->{'hosts'}} ) { - $e = '^' . $e; - if ( $host =~ /$e/ ) { $m = 1; last; } + if ( $host =~ /^$e/ ) { $m = 1; last; } } if (! $m) { &debug("No match for host $host on rule $c, checking host groups"); @@ -400,8 +397,7 @@ RULE: } else { $m = 0; foreach $e ( @{$rule->{'services'}} ) { - $e = '^' . $e; - if ( $service =~ /$e/ ) { $m = 1; last; } + if ( $service =~ /^$e/ ) { $m = 1; last; } } if (! $m) { &debug("No match for service $service on rule $c");