[Mimedefang] Including archetypal filters to include in release?

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Mon Jan 9 19:02:23 EST 2006


Philip Prindeville wrote:
> 
> my %badnetworks = {
>     '58.71.0.0/17'      => 'REJECT',
>     '62.117.127.0/25'   => 'REJECT',
...
>     '222.136.0.0/11'    => 'REJECT',
>     # local mail
>     '127.0.0.1/32'      => 'ACCEPT',
>     '192.168.1.0/24'    => 'ACCEPT',
>     # wildcard action
>     '0.0.0.0/0'         => 'ACCEPT',
> };
> 
... 
>     while (my ($lhs, $action) = each %badnetworks) {
>         my ($net, $length) = split('/', $lhs);

Umm... note that each %hash returns the key/value pairs in hash order.  This is NOT NECESSARILY THE SAME as the order you entered them into the hash.  If you happen to hit 0.0.0.0/0 => ACCEPT as the first entry none of your blacklists will take effect.

You could fix this by using two arrays:

my @badnetworks = ( '58.71.0.0/17', ...);
my @goodnetworks = ( '127.0.0.1/32', ... );

and iterating over each separately.

-- 
Matthew.van.Eerde (at) hbinc.com               805.964.4554 x902
Hispanic Business Inc./HireDiversity.com       Software Engineer




More information about the MIMEDefang mailing list