changeset 100:075b2b626d17 maltfilter-0.20.0

Fix check for number of SCANFILEs and SCANFILE_ONCEs.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 06 Sep 2009 22:02:36 +0300
parents ca0fd7f3909b
children 8835840a51ab
files README maltfilter
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/README	Mon Aug 31 11:58:05 2009 +0300
+++ b/README	Sun Sep 06 22:02:36 2009 +0300
@@ -1,4 +1,4 @@
-Malicious Attack Livid Termination Filter daemon (maltfilter) v0.19.4
+Malicious Attack Livid Termination Filter daemon (maltfilter) v0.20.0
 =====================================================================
 Programmed by Matti 'ccr' Hämäläinen <ccr@tnsp.org>
 (C) Copyright 2009 Tecnic Software productions (TNSP)
--- a/maltfilter	Mon Aug 31 11:58:05 2009 +0300
+++ b/maltfilter	Sun Sep 06 22:02:36 2009 +0300
@@ -13,7 +13,7 @@
 use LWP::UserAgent;
 use IO::Seekable;
 
-my $progversion = "0.19.4";
+my $progversion = "0.20.0";
 my $progbanner =
 "Malicious Attack Livid Termination Filter daemon (maltfilter) v$progversion\n".
 "Programmed by Matti 'ccr' Hamalainen <ccr\@tnsp.org>\n".
@@ -340,7 +340,7 @@
       if ($class ne "IPTABLES") {
       if ($reportmode) {
         my @tmp = reverse(@{$table->{$mip}{"reason"}{$class}{"msg"}});
-        if ($#tmp > 5) { $#tmp = 5; }
+        if (scalar @tmp > 5) { $#tmp = 5; }
         foreach (@tmp) { $_ = htmlentities($_); }
         $msgs = join(" ".bb($m)."|".eb($m)." ", @tmp);
       } else {
@@ -539,6 +539,7 @@
 {
   return unless ($settings{"DRONEBL"} > 0);
 
+  # If suspended, bail out until it's time to retry
   if ($dronebl_suspend > 0) {
     $dronebl_suspend--;
     return;
@@ -636,8 +637,12 @@
   my ($mip, $mdate, $mtype) = @_;
 
   return unless ($settings{"DRONEBL"} > 0);
+
+  # Check against noaction IPs
   return if check_hosts_array(\@noaction_ips, $mip);
 
+  # If we have the host/IP in "recent memory", and it has been submitted
+  # or queued already, do not requeue.
   if (defined($statlist{$mip}) && defined($statlist{$mip}{"dronebl"})) {
     return if ($statlist{$mip}{"dronebl"} > 0);
   }
@@ -1229,9 +1234,9 @@
 
   # Check if we have anything to do
   if ($reportmode) {
-    mdie("Nothing to do, no SCANFILE(s) or SCANFILE_ONCE(s) defined in configuration.\n") unless ($#scanfiles > 0 || $#scanfiles_once > 0);
+    mdie("Nothing to do, no SCANFILE(s) or SCANFILE_ONCE(s) defined in configuration.\n") unless (scalar @scanfiles > 0 || scalar @scanfiles_once > 0);
   } else {
-    mdie("Nothing to do, no SCANFILE(s) defined in configuration.\n") unless ($#scanfiles > 0);
+    mdie("Nothing to do, no SCANFILE(s) defined in configuration.\n") unless (scalar @scanfiles > 0);
   }
 
   # General settings