changeset 8:29ddb6b9b521

Moar changes!
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 13 Aug 2009 19:13:07 +0300
parents ee5f7b8dcdea
children d869f924f97e
files maltfilter
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/maltfilter	Thu Aug 13 18:55:55 2009 +0300
+++ b/maltfilter	Thu Aug 13 19:13:07 2009 +0300
@@ -131,16 +131,15 @@
 }
 
 
-sub check_hosts_array(@$)
+sub check_hosts_array($$)
 {
-  my @hostlist = shift;
-  my $chk_host = shift;
+  my $chk_host = $_[1];
   my $chk_ip = new Net::IP($chk_host);
-  foreach my $host (@hostlist) {
-    my $ip = new Net::IP($host);
+  foreach my $host (@{$_[0]}) {
     if ($chk_host eq $host) {
       return 1;
     }
+    my $ip = new Net::IP($host);
     if (defined($chk_ip) && defined($ip)) {
       if ($chk_ip->binip() eq $ip->binip()) {
         return 1;
@@ -152,7 +151,8 @@
 
 sub check_hosts($$)
 {
-  return check_hosts_array(split(/\s*\|\s*/, $_[0]), $_[1]);
+  my @tmp = split(/\s*\|\s*/, $_[0]);
+  return check_hosts_array(\@tmp, $_[1]);
 }
 
 
@@ -382,7 +382,7 @@
       my $value = $2;
       if ($key eq "SCANFILE") {
         push(@scanfiles_def, $value);
-      elsif ($key eq "NOBLOCK_IPS") {
+      } elsif ($key eq "NOBLOCK_IPS") {
         push(@noblock_ips_def, $value);
       } elsif (defined($settings{$key})) {
         $settings{$key} = $value;
@@ -425,6 +425,8 @@
   die($msg);
 }
 
+mlog(-1, "Not blocking following IPs: ".join(", ", @noblock_ips)."\n");
+
 # Initialize
 update_iplist(-1);
 malt_init();