spamassassin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j.@apache.org
Subject svn commit: r637123 - in /spamassassin/trunk: ./ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/Message/Metadata/ t/
Date Fri, 14 Mar 2008 14:55:39 GMT
Author: jm
Date: Fri Mar 14 07:55:35 2008
New Revision: 637123

URL: http://svn.apache.org/viewvc?rev=637123&view=rev
Log:
bug 4964: IPv6 support for trusted_networks, internal_networks,
whitelist_from_rcvd, msa_networks, and other stuff that uses NetSet and the
Received header parser, using NetAddr::IP.  (Mail::SPF already requires
NetAddr::IP, so this is "free" for people who have that installed).

Changes involved:

- IP_PRIVATE now includes the ipv6 variants of private address space, as well
  as the ipv6-mapped ipv4 addresses.

- NetSet now understands that ::ffff:192.168.1.2 and 192.168.1.2 are the same
  address.

- when reading Received hdrs, the "IPv6:" prefix is stripped from ipv6
  addresses, and "::ffff:" is removed from ipv6-mapped ipv4 addresses (so
  strings can match them as simply ipv4 addrs).

- ::1 is always included in the trusted_networks/internal_networks set, similar
  to 127/8.

- lots of new tests have been added to exercise this.


Modified:
    spamassassin/trunk/INSTALL
    spamassassin/trunk/Makefile.PL
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm
    spamassassin/trunk/t/cidrs.t
    spamassassin/trunk/t/ip_addrs.t
    spamassassin/trunk/t/rcvd_parser.t
    spamassassin/trunk/t/trust_path.t

Modified: spamassassin/trunk/INSTALL
URL: http://svn.apache.org/viewvc/spamassassin/trunk/INSTALL?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/INSTALL (original)
+++ spamassassin/trunk/INSTALL Fri Mar 14 07:55:35 2008
@@ -198,6 +198,13 @@
       - version 0.34 or higher on Unix systems
       - version 0.46 or higher on Windows systems
 
+  - NetAddr::IP (from CPAN)
+
+    Used to parse IP addresses and IP address ranges for
+    "trusted_networks".
+
+    Debian/Ubuntu: apt-get install libnetaddr-ip-perl
+
   - LWP (aka libwww-perl) (from CPAN)
 
     This set of modules will include both the LWP::UserAgent and

Modified: spamassassin/trunk/Makefile.PL
URL: http://svn.apache.org/viewvc/spamassassin/trunk/Makefile.PL?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/Makefile.PL (original)
+++ spamassassin/trunk/Makefile.PL Fri Mar 14 07:55:35 2008
@@ -216,6 +216,7 @@
         'Pod::Usage'    => 1.10,          # all versions prior to this do seem to be buggy
         'HTML::Parser'  => 3.43,          # the HTML code is based on this parser, older
versions have utf-8 bugs
         'Net::DNS'      => (RUNNING_ON_WINDOWS ? 0.46 : 0.34), # bugs in older revs
+        'NetAddr::IP'   => 0,
         'Sys::Hostname' => 0,
         'Time::Local'   => 0,
         'Errno'         => 0,

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Fri Mar 14 07:55:35 2008
@@ -987,13 +987,15 @@
 If a network or host address is prefaced by a C<!> the network or host will be
 excluded (or included) in a first listed match fashion.
 
-Note: 127/8 is always included in trusted_networks, regardless of your config.
+Note: 127/8 and ::1 are always included in trusted_networks, regardless of
+your config.
 
 Examples:
 
    trusted_networks 192.168/16            # all in 192.168.*.*
    trusted_networks 212.17.35.15          # just that host
    trusted_networks !10.0.1.5 10.0.1/24   # all in 10.0.1.* but not 10.0.1.5
+   trusted_networks DEAD:BEEF::/32        # all in that ipv6 prefix
 
 This operates additively, so a C<trusted_networks> line after another one
 will append new entries to the list of trusted networks.  To clear out the
@@ -1079,7 +1081,8 @@
 Every entry in C<internal_networks> must appear in C<trusted_networks>; in
 other words, C<internal_networks> is always a subset of the trusted set.
 
-Note: 127/8 is always included in internal_networks, regardless of your config.
+Note: 127/8 and ::1 are always included in internal_networks, regardless of
+your config.
 
 =cut
 
@@ -3684,6 +3687,7 @@
   my ($self) = @_;
   my $set = Mail::SpamAssassin::NetSet->new();
   $set->add_cidr ('127/8');
+  $set->add_cidr ('::1');
   return $set;
 }
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Constants.pm Fri Mar 14 07:55:35 2008
@@ -80,23 +80,96 @@
 #   3330  = <ftp://ftp.rfc-editor.org/in-notes/rfc3330.txt>
 #   CYMRU = <http://www.cymru.com/Documents/bogon-list.html>
 #
-# Last update
-#   2005-01-10 Daniel Quinlan - reduced to standard private IP addresses
+# This also includes IPv6 link-local space, fe80::/10, the IPv4
+# spaces mapped in IPv6, and the IPv6 host-local address, ::1.
 #
 use constant IP_PRIVATE => qr{^(?:
-  10|				   # 10/8:             Private Use (3330)
-  127|				   # 127/8:            Private Use (localhost)
-  169\.254|			   # 169.254/16:       Private Use (APIPA)
-  172\.(?:1[6-9]|2[0-9]|3[01])|	   # 172.16-172.31/16: Private Use (3330)
-  192\.168			   # 192.168/16:       Private Use (3330)
-)\.}ox;
+  (?:   # IPv4 addresses
+    10|				    # 10/8:             Private Use (3330)
+    127|                            # 127/8:            Private Use (localhost)
+    169\.254|			    # 169.254/16:       Private Use (APIPA)
+    172\.(?:1[6-9]|2[0-9]|3[01])|   # 172.16-172.31/16: Private Use (3330)
+    192\.168 			    # 192.168/16:       Private Use (3330)
+    )\..*
+|
+  (?:   # IPv6 addresses
+    # don't use \b here, it hits on :'s
+    (?:IPv6:    # with optional prefix
+      | (?<![a-f0-9:])
+    )
+    (?:
+      # IPv4 mapped in IPv6
+      # note the colon after the 12th byte in each here
+      (?:
+        # first 6 (12 bytes) non-zero
+        (?:0{1,4}:){5}		ffff:
+        |
+        # leading zeros omitted (note {0,5} not {1,5})
+        ::(?:0{1,4}:){0,4}		ffff:
+        |
+        # trailing zeros (in the first 6) omitted
+        (?:0{1,4}:){1,4}:		ffff:
+        |
+        # 0000 in second up to (including) fifth omitted
+        0{1,4}::(?:0{1,4}:){1,3}	ffff:
+        |
+        # 0000 in third up to (including) fifth omitted
+        (?:0{1,4}:){2}:0{1,2}:	ffff:
+        |
+        # 0000 in fourth up to (including) fifth omitted
+        (?:0{1,4}:){3}:0:		ffff:
+        |
+        # 0000 in fifth omitted
+        (?:0{1,4}:){4}:		ffff:
+      )
+      # and the IPv4 address appended to all of the 12 bytes above
+      (?:
+        10|
+        127|			    
+        169\.254|			    
+        172\.(?:1[6-9]|2[0-9]|3[01])|   
+        192\.168
+      )\..*
+
+    | # or IPv6 link-local address space, fe80::/10
+      fe[89ab][0-9a-f]:.*
+
+    | # or the host-local ::1 addr, as a pure IPv6 address
+
+      # all 8 (16 bytes) of them present
+      (?:0{1,4}:){7}			0{0,3}1
+      |
+      # leading zeros omitted
+      :(?::0{1,4}){0,6}:		0{0,3}1
+      |
+      # 0000 in second up to (including) seventh omitted
+      0{1,4}:(?::0{1,4}){0,5}:	0{0,3}1
+      |
+      # 0000 in third up to (including) seventh omitted
+      (?:0{1,4}:){2}(?::0{1,4}){0,4}:	0{0,3}1
+      |
+      # 0000 in fouth up to (including) seventh omitted
+      (?:0{1,4}:){3}(?::0{1,4}){0,3}:	0{0,3}1
+      |
+      # 0000 in fifth up to (including) seventh omitted
+      (?:0{1,4}:){4}(?::0{1,4}){0,2}:	0{0,3}1
+      |
+      # 0000 in sixth up to (including) seventh omitted
+      (?:0{1,4}:){5}(?::0{1,4}){0,1}:	0{0,3}1
+      |
+      # 0000 in seventh omitted
+      (?:0{1,4}:){6}:			0{0,3}1
+    )
+    (?![a-f0-9:])
+  )
+)}oxi;
 
 # backward compatibility
 use constant IP_IN_RESERVED_RANGE => IP_PRIVATE;
 
 # ---------------------------------------------------------------------------
 # match the various ways of saying "localhost".
-# 
+
 use constant LOCALHOST => qr/
 		    (?:
 		      # as a string

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm Fri Mar 14 07:55:35
2008
@@ -1210,12 +1210,6 @@
     dbg("received-header: could not parse IP address from: $_");
   }
 
-  $ip = Mail::SpamAssassin::Util::extract_ipv4_addr_from_string ($ip);
-  if (!$ip) {
-    dbg("received-header: could not parse IPv4 address, assuming IPv6");
-    return 0;   # ignore IPv6 handovers
-  }
-
   # DISABLED: if we cut out localhost-to-localhost SMTP handovers,
   # we will give FPs on SPF checks -- since the SMTP "MAIL FROM" addr
   # will be recorded, but we won't have the relays handover recorded
@@ -1231,6 +1225,14 @@
   if ($rdns =~ /^unknown$/i) {
     $rdns = '';		# some MTAs seem to do this
   }
+  
+  $ip =~ s/^\[//; $ip =~ s/\]$//;
+
+  $ip =~ s/^ipv6://i;   # remove optional "IPv6:" prefix
+
+  # remove "::ffff:" prefix from IPv4-mapped-in-IPv6 addresses,
+  # so we can treat them as simply IPv4 addresses
+  $ip =~ s/^0*:0*:(?:0*:)*ffff:(\d+\.\d+\.\d+\.\d+)$/$1/i;
 
   $envfrom =~ s/^\s*<*//gs; $envfrom =~ s/>*\s*$//gs;
   $by =~ s/\;$//;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/NetSet.pm Fri Mar 14 07:55:35 2008
@@ -22,6 +22,7 @@
 use warnings;
 use bytes;
 use re 'taint';
+use NetAddr::IP;
 
 use Mail::SpamAssassin::Util;
 use Mail::SpamAssassin::Logger;
@@ -53,40 +54,40 @@
   $self->{nets} ||= [ ];
   my $numadded = 0;
 
-  foreach (@nets) {
-    my $exclude = s/^\s*!// ? 1 : 0;
-    my ($ip, $bits) = m#^\s*
-			((?:(?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.){0,3}
-			    (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)?) (?:(?<!\.)/(\d+))?
-		      \s*$#x;
+  foreach my $cidr (@nets) {
+    my $exclude = ($cidr =~ s/^\s*!//) ? 1 : 0;
 
-    my $err = "netset: illegal network address given: '$_'\n";
+    my $is_ip4 = 0;
+    if ($cidr =~ /^\d+[\.\/]/) {
+      if ($cidr =~ /^(\d+)\.(\d+)\.(\d+)\.$/) { $cidr = "$1.$2.$3.0/24"; }
+      elsif ($cidr =~ /^(\d+)\.(\d+)\.$/) { $cidr = "$1.$2.0.0/16"; }
+      elsif ($cidr =~ /^(\d+)\.$/) { $cidr = "$1.0.0.0/8"; }
+      $is_ip4 = 1;
+    }
+
+    my $ip = NetAddr::IP->new($cidr);
     if (!defined $ip) {
-      warn $err;
+      warn "netset: illegal network address given: '$cidr'\n";
       next;
     }
-    elsif ($ip =~ /\.$/) {
-      # just use string matching; much simpler than doing smart stuff with arrays ;)
-      if ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.$/) { $ip = "$1.$2.$3.0"; $bits = 24; }
-      elsif ($ip =~ /^(\d+)\.(\d+)\.$/) { $ip = "$1.$2.0.0"; $bits = 16; }
-      elsif ($ip =~ /^(\d+)\.$/) { $ip = "$1.0.0.0"; $bits = 8; }
-      else {
-	warn $err;
-	next;
-      }
-    }
 
-    $bits = 32 if (!defined $bits);
-
-    next if ($self->is_net_declared($ip, $bits, $exclude, 0));
+    # if this is an IPv4 address, create an IPv6 representation, too
+    my ($ip4, $ip6);
+    if ($is_ip4) {
+      $ip4 = $ip;
+      $ip6 = $self->_convert_ipv4_cidr_to_ipv6($cidr);
+    } else {
+      $ip6 = $ip;
+    }
 
-    my $mask = 0xFFffFFff ^ ((2 ** (32-$bits)) - 1);
+    next if ($self->is_net_declared($ip4, $ip6, $exclude, 0));
 
+    # note: it appears a NetAddr::IP object takes up about 279 bytes
     push @{$self->{nets}}, {
-      mask    => $mask,
       exclude => $exclude,
-      ip      => (Mail::SpamAssassin::Util::my_inet_aton($ip) & $mask),
-      as_string => $_
+      ip4     => $ip4,
+      ip6     => $ip6,
+      as_string => $cidr
     };
     $numadded++;
   }
@@ -101,21 +102,41 @@
   return scalar @{$self->{nets}};
 }
 
+sub _convert_ipv4_cidr_to_ipv6 {
+  my ($self, $cidr) = @_;
+
+  # only do this for IPv4 addresses
+  return undef unless ($cidr =~ /^\d+[.\/]/);
+
+  if ($cidr !~ /\//) {      # no mask
+    return NetAddr::IP->new6("::ffff:".$cidr);
+  }
+
+  # else we have a CIDR mask specified. use new6() to do this
+  #
+  my $ip6 = ""+(NetAddr::IP->new6($cidr));
+  # 127.0.0.1 -> 0:0:0:0:0:0:7F00:0001/128
+  # 127/8 -> 0:0:0:0:0:0:7F00:0/104
+
+  # now, move that from 0:0:0:0:0:0: space to 0:0:0:0:0:ffff: space
+  if (!defined $ip6 || $ip6 !~ /^0:0:0:0:0:0:(.*)$/) {
+    warn "oops! unparseable IPv6 address for $cidr: $ip6";
+    return undef;
+  }
+
+  return NetAddr::IP->new6("::ffff:$1");
+}
+
 sub _nets_contains_network {
-  my ($self, $network, $mask, $exclude, $quiet, $netname, $declared) = @_;
+  my ($self, $net4, $net6, $exclude, $quiet, $netname, $declared) = @_;
 
   return 0 unless (defined $self->{nets});
 
-  $exclude = 0 if (!defined $exclude);
-  $quiet = 0 if (!defined $quiet);
-  $declared = 0 if (!defined $declared);
-
   foreach my $net (@{$self->{nets}}) {
-    # a net can not be contained by a (smaller) net with a larger mask
-    next if ($net->{mask} > $mask);
-
     # check to see if the new network is contained by the old network
-    if (($network & $net->{mask}) == $net->{ip}) {
+    my $in4 = defined $net4 && defined $net->{ip4} && $net->{ip4}->contains($net4);
+    my $in6 = defined $net6 && defined $net->{ip6} && $net->{ip6}->contains($net6);
+    if ($in4 || $in6) {
       warn "netset: cannot " . ($exclude ? "exclude" : "include") 
 	 . " $netname as it has already been "
 	 . ($net->{exclude} ? "excluded" : "included") . "\n" unless $quiet;
@@ -130,35 +151,38 @@
 }
 
 sub is_net_declared {
-  my ($self, $network, $bits, $exclude, $quiet) = @_;
-
-  my $mask = 0xFFffFFff ^ ((2 ** (32-$bits)) - 1);
-  my $aton = Mail::SpamAssassin::Util::my_inet_aton($network);
-
-  return $self->_nets_contains_network($aton, $mask, $exclude,
-                $quiet, "$network/$bits", 1);
+  my ($self, $net4, $net6, $exclude, $quiet) = @_;
+  return $self->_nets_contains_network($net4, $net6, $exclude,
+                $quiet, $net4 || $net6, 1);
 }
 
 sub contains_ip {
   my ($self, $ip) = @_;
 
   if (!defined $self->{nets}) { return 0; }
-  if ($ip !~ m/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { return 0; }
 
-  $ip = Mail::SpamAssassin::Util::my_inet_aton($ip);
+  my ($ip4, $ip6);
+  if ($ip =~ /^\d+\./) {
+    $ip4 = NetAddr::IP->new($ip);
+    $ip6 = $self->_convert_ipv4_cidr_to_ipv6($ip);
+  } else {
+    $ip6 = NetAddr::IP->new($ip);
+  }
+
   foreach my $net (@{$self->{nets}}) {
-    return !$net->{exclude} if (($ip & $net->{mask}) == $net->{ip});
+    return !$net->{exclude} if
+        ((defined $ip4 && defined $net->{ip4} && $net->{ip4}->contains($ip4))
+        || (defined $ip6 && defined $net->{ip6} && $net->{ip6}->contains($ip6)));
   }
-  0;
+  return 0;
 }
 
 sub contains_net {
   my ($self, $net) = @_;
-  my $mask    = $net->{mask};
   my $exclude = $net->{exclude};
-  my $network = $net->{ip};
-
-  return $self->_nets_contains_network($network, $mask, $exclude, 1, "", 0);
+  my $net4 = $net->{ip4};
+  my $net6 = $net->{ip6};
+  return $self->_nets_contains_network($net4, $net6, $exclude, 1, "", 0);
 }
 
 sub clone {

Modified: spamassassin/trunk/t/cidrs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cidrs.t?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/t/cidrs.t (original)
+++ spamassassin/trunk/t/cidrs.t Fri Mar 14 07:55:35 2008
@@ -17,17 +17,17 @@
 
 use strict;
 use Test;
-use Mail::SpamAssassin;
 
+plan tests => 51;
+
+use Mail::SpamAssassin;
 use Mail::SpamAssassin::NetSet;
 
 my $sa = Mail::SpamAssassin->new({
     rules_filename => "$prefix/rules",
 });
 
-plan tests => 22;
-
-sub tryone {
+sub tryone ($@) {
   my ($testip, @nets) = @_;
   my $nets = Mail::SpamAssassin::NetSet->new();
   foreach my $net (@nets) { $nets->add_cidr ($net); }
@@ -39,28 +39,85 @@
   }
 }
 
-ok (tryone ("127.0.0.1", "127.0.0.1"));
-ok (!tryone ("127.0.0.2", "127.0.0.1"));
+sub trynet ($@) {
+  my ($cidr, @nets) = @_;
+  my $net = Mail::SpamAssassin::NetSet->new();
+  $net->add_cidr ($cidr);
+
+  my $nets = Mail::SpamAssassin::NetSet->new();
+  foreach my $net (@nets) { $nets->add_cidr ($net); }
+
+  if ($nets->contains_net ($net->{nets}->[0])) {
+    print "\n$cidr was in @nets\n"; return 1;
+  } else {
+    print "\n$cidr was not in @nets\n"; return 0;
+  }
+}
+
+ok tryone "127.0.0.1", "127.0.0.1";
+ok !tryone "127.0.0.2", "127.0.0.1";
 
-ok (tryone ("127.0.0.1", "127."));
-ok (tryone ("127.0.0.254", "127."));
-ok (tryone ("127.0.0.1", "127/8"));
-ok (tryone ("127.0.0.1", "127.0/16"));
-ok (tryone ("127.0.0.1", "127.0.0/24"));
-ok (tryone ("127.0.0.1", "127.0.0.1/32"));
-ok (tryone ("127.0.0.1", "127.0.0.1/31"));
-ok (tryone ("127.0.0.1", "10.", "11.", "127.0.0.1"));
-ok (tryone ("127.0.0.1", "127.0."));
-ok (tryone ("127.0.0.1", "127.0.0."));
-ok (tryone ("127.0.0.1", "127."));
-
-ok (!tryone ("128.0.0.254", "127."));
-ok (!tryone ("128.0.0.1", "127/8"));
-ok (!tryone ("128.0.0.1", "127.0/16"));
-ok (!tryone ("128.0.0.1", "127.0.0/24"));
-ok (!tryone ("128.0.0.1", "127.0.0.1/32"));
-ok (!tryone ("128.0.0.1", "127.0.0.1/31"));
-ok (!tryone ("128.0.0.1", "127.0."));
-ok (!tryone ("128.0.0.1", "127.0.0."));
-ok (!tryone ("12.9.0.1", "10.", "11.", "127.0.0.1"));
+ok tryone "127.0.0.1", "127.";
+ok tryone "127.0.0.254", "127.";
+ok tryone "127.0.0.1", "127/8";
+ok tryone "127.0.0.1", "127.0/16";
+ok tryone "127.0.0.1", "127.0.0/24";
+ok tryone "127.0.0.1", "127.0.0.1/32";
+ok tryone "127.0.0.1", "127.0.0.1/31";
+ok tryone "127.0.0.1", "10.", "11.", "127.0.0.1";
+ok tryone "127.0.0.1", "127.0.";
+ok tryone "127.0.0.1", "127.0.0.";
+ok tryone "127.0.0.1", "127.";
+
+ok !tryone "128.0.0.254", "127.";
+ok !tryone "128.0.0.1", "127/8";
+ok !tryone "128.0.0.1", "127.0/16";
+ok !tryone "128.0.0.1", "127.0.0/24";
+ok !tryone "128.0.0.1", "127.0.0.1/32";
+ok !tryone "128.0.0.1", "127.0.0.1/31";
+ok !tryone "128.0.0.1", "127.0.";
+ok !tryone "128.0.0.1", "127.0.0.";
+ok !tryone "12.9.0.1", "10.", "11.", "127.0.0.1";
+
+ok !tryone "127.0.0.1", "::DEAD:BEEF";
+ok tryone "DEAD:BEEF:0000:0102:0304:0506:0708:0a0b",
+          "DEAD:BEEF:0000:0102:0304:0506::/96";
+ok tryone "DEAD:BEEF:0000:0102:0304:0506:0708:0a0b",
+          "DEAD:BEEF:0000:0102:0304:0506:0:0/96";
+ok tryone "fec0:02::0060:1dff:fff7:2109",
+          "fec0:02::0060:1dff:fff7:2109";
+ok tryone "::1", "::1";
+ok tryone "::1", "0:0:0:0:0:0:0:1";
+ok tryone "::1", "0:0:0::0:1";
+ok tryone "::1", "::/96";
+
+# various equivalences of ipv4 and ipv4-mapped-ipv6
+ok tryone "::ffff:127.0.0.1", "127/8";
+ok tryone "::ffff:127.0.0.1", "127.0.0.1";
+ok tryone "::ffff:127.0.0.1", "::ffff:127.0.0.1";
+ok tryone "127.0.0.1", "::ffff:127.0.0.1";
+ok tryone "127.0.0.1", "::ffff:7f00:0000/112";
+ok tryone "127.0.0.1", "::ffff:7f00:0001";
+ok tryone "127.0.0.1", "0000:0000:0000:0000:0000:ffff:127.0.0.0/112";
+ok tryone "127.0.0.1", "0000:0000:0000:0000:0000:ffff:127.0.0.1";
+
+ok !tryone "127.0.0.1", "::127.0.0.1";
+ok !tryone "::127.0.0.1", "127.0.0.1";
+ok !tryone "::127.0.0.1", "127/8";
+ok !tryone "127.0.0.1", "::7f00:0000/112";
+
+ok trynet "1.1/16", "1.1/16";
+ok trynet "1.1/16", "1.1/15";
+ok !trynet "1.1/16", "1.1/17";
+ok !trynet "1.1/16", "1.1.1/24";
+ok trynet "1.1.1/24", "1.1/16";
+
+ok trynet "DEAD:BEEF:0000:0102:0304:0506:0:0/96",
+          "DEAD:BEEF:0000:0102:0304:0506:0:0/96";
+ok trynet "DEAD:BEEF:0000:0102:0304:0506:0:0/96",
+          "DEAD:BEEF:0000:0102:0304:0506:0:0/95";
+ok trynet "DEAD:BEEF:0000:0102:0304:0506:0:0/96",
+          "DEAD:BEEF:0000:0102:0304:0506:1:1/90";
+ok !trynet "DEAD:BEEF:0000:0102:0304:0506:1:1/90",
+          "DEAD:BEEF:0000:0102:0304:0506:0:0/96";
 

Modified: spamassassin/trunk/t/ip_addrs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/ip_addrs.t?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/t/ip_addrs.t (original)
+++ spamassassin/trunk/t/ip_addrs.t Fri Mar 14 07:55:35 2008
@@ -26,9 +26,9 @@
     rules_filename => "$prefix/rules",
 });
 
-plan tests => 77;
+plan tests => 105;
 
-sub tryone {
+sub tryone ($$) {
   my ($pat, $testip) = @_;
 #warn "matching $testip gainst $pat\n";
   if ($testip =~ /^$pat$/) {
@@ -40,71 +40,104 @@
 
 use Mail::SpamAssassin::Constants qw(:all);
 
-sub tryipv4s {
+sub tryipv4s ($) {
   my $pat = shift;
-  ok (tryone ($pat, "127.0.0.1"));
-  ok (tryone ($pat, "255.255.255.255"));
-  ok (tryone ($pat, "1.0.0.1"));
-  ok (tryone ($pat, "0.0.0.1"));
-  ok (tryone ($pat, "255.5.4.128"));
-  ok (!tryone ($pat, "255.5.n.128"));
-  ok (!tryone ($pat, "-1.0.0.1"));
-  ok (!tryone ($pat, "256.0.0.1"));
-  ok (!tryone ($pat, "10.0.0.256"));
-  ok (!tryone ($pat, "10.0.0.999999"));
-  ok (!tryone ($pat, "255.5.-1.128"));
-  ok (!tryone ($pat, "255.5.-1.128."));
-  ok (!tryone ($pat, "100.1.2"));
-  ok (!tryone ($pat, "100.1"));
+  ok tryone $pat, "127.0.0.1";
+  ok tryone $pat, "255.255.255.255";
+  ok tryone $pat, "1.0.0.1";
+  ok tryone $pat, "0.0.0.1";
+  ok tryone $pat, "255.5.4.128";
+  ok !tryone $pat, "255.5.n.128";
+  ok !tryone $pat, "-1.0.0.1";
+  ok !tryone $pat, "256.0.0.1";
+  ok !tryone $pat, "10.0.0.256";
+  ok !tryone $pat, "10.0.0.999999";
+  ok !tryone $pat, "255.5.-1.128";
+  ok !tryone $pat, "255.5.-1.128.";
+  ok !tryone $pat, "100.1.2";
+  ok !tryone $pat, "100.1";
 }
 
-tryipv4s (Mail::SpamAssassin::Constants::IPV4_ADDRESS);
-tryipv4s (Mail::SpamAssassin::Constants::IP_ADDRESS);
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "::ffff:64.142.3.173"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "fec0::1"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "1080:0:0:0:8:800:200C:417A"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "1080::8:800:200C:417A"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "0:0:0:0:0:0:0:0"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "::"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "fec0:02::0060:1dff:fff7:2109"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "fec0:02::0060:1dff:ff1e:26ee"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:ffff:0100:f101:0210:a4ff:fee3:9566"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:ffff:100:f101:210:a4ff:fee3:9566"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:ffff:100:f101::1"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "::1"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "::192.168.0.1"));
-ok (!tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:"));
-ok (!tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:9348"));
-ok (!tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:fffff:100:f101:210:a4ff:fee3:9566"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "ff02:0:0:0:0:0:0:1"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "ff02:0:0:0:0:0:0:2"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "IPv6:::1"));
-ok (tryone (Mail::SpamAssassin::Constants::IP_ADDRESS, "IPv6:3ffe:2500:310:3:20a:95ff:fef5:246e"));
-
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "localhost"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "localhost.localdomain"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "127.0.0.1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "::ffff:127.0.0.1"));
-ok (!tryone (Mail::SpamAssassin::Constants::LOCALHOST, ":::ffff:127.0.0.1"));
-ok (!tryone (Mail::SpamAssassin::Constants::LOCALHOST, "0000:0000:0000:ffff:127.0.0.1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "0000:0000:0000:0000:0000:ffff:127.0.0.1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "::1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "0:0:0:0:0:0:0:1"));
-ok (!tryone (Mail::SpamAssassin::Constants::LOCALHOST, "3ffe:fffff:100:f101:210:a4ff:fee3:9566"));
-ok (!tryone (Mail::SpamAssassin::Constants::LOCALHOST, "::192.168.0.1"));
-ok (!tryone (Mail::SpamAssassin::Constants::LOCALHOST, "notlocalhost"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "IPv6:::1"));
-ok (!tryone (Mail::SpamAssassin::Constants::LOCALHOST, "IPv6:3ffe:2500:310:3:20a:95ff:fef5:246e"));
-
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "::0:0:0:0:0:0:1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "::0:0:0:0:1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "0::0:0:0:0:0:1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "0:0::0:0:0:0:1"));
-ok (tryone (Mail::SpamAssassin::Constants::LOCALHOST, "0:0:0::0:0:1"));
+tryipv4s Mail::SpamAssassin::Constants::IPV4_ADDRESS;
+tryipv4s Mail::SpamAssassin::Constants::IP_ADDRESS;
 
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "::ffff:64.142.3.173";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "fec0::1";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "1080:0:0:0:8:800:200C:417A";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "1080::8:800:200C:417A";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "0:0:0:0:0:0:0:0";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "::";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "fec0:02::0060:1dff:fff7:2109";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "fec0:02::0060:1dff:ff1e:26ee";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:ffff:0100:f101:0210:a4ff:fee3:9566";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:ffff:100:f101:210:a4ff:fee3:9566";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:ffff:100:f101::1";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "::1";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "::192.168.0.1";
+ok !tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:";
+ok !tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:9348";
+ok !tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "3ffe:fffff:100:f101:210:a4ff:fee3:9566";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "ff02:0:0:0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "ff02:0:0:0:0:0:0:2";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "IPv6:::1";
+ok tryone Mail::SpamAssassin::Constants::IP_ADDRESS, "IPv6:3ffe:2500:310:3:20a:95ff:fef5:246e";
+
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "localhost";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "localhost.localdomain";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "127.0.0.1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "::ffff:127.0.0.1";
+ok !tryone Mail::SpamAssassin::Constants::LOCALHOST, ":::ffff:127.0.0.1";
+ok !tryone Mail::SpamAssassin::Constants::LOCALHOST, "0000:0000:0000:ffff:127.0.0.1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "0000:0000:0000:0000:0000:ffff:127.0.0.1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "::1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "0:0:0:0:0:0:0:1";
+ok !tryone Mail::SpamAssassin::Constants::LOCALHOST, "3ffe:fffff:100:f101:210:a4ff:fee3:9566";
+ok !tryone Mail::SpamAssassin::Constants::LOCALHOST, "::192.168.0.1";
+ok !tryone Mail::SpamAssassin::Constants::LOCALHOST, "notlocalhost";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "IPv6:::1";
+ok !tryone Mail::SpamAssassin::Constants::LOCALHOST, "IPv6:3ffe:2500:310:3:20a:95ff:fef5:246e";
+
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "::0:0:0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "::0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "0::0:0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "0:0::0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::LOCALHOST, "0:0:0::0:0:1";
+
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "127.0.0.1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "::ffff:127.0.0.1";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, ":::ffff:127.0.0.1";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0000:0000:0000:ffff:127.0.0.1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0000:0000:0000:0000:0000:ffff:127.0.0.1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "192.168.12.3";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "::ffff:192.168.12.3";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, ":::ffff:192.168.12.3";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0000:0000:0000:ffff:192.168.12.3";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0000:0000:0000:0000:0000:ffff:192.168.12.3";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "::1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0:0:0:0:0:0:0:1";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "3ffe:fffff:100:f101:210:a4ff:fee3:9566";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "::192.168.0.1";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "notlocalhost";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "IPv6:::1";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "IPv6:3ffe:2500:310:3:20a:95ff:fef5:246e";
+
+# fe80::/10 link-local
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "IPv6:fe80:2500:310:3:20a:95ff:fef5:246e";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "IPv6:fe93:2500:310:3:20a:95ff:fef5:246e";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "fea9:2500:310:3:20a:95ff:fef5:246e";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "feb0::310:3:20a:95ff:fef5:246e";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "fec0:2500:310:3:20a:95ff:fef5:246e";
+ok !tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "fe7f:2500:310:3:20a:95ff:fef5:246e";
+
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "::0:0:0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "::0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0::0:0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0:0::0:0:0:0:1";
+ok tryone Mail::SpamAssassin::Constants::IP_PRIVATE, "0:0:0::0:0:1";
 
-sub tsttrim {
+
+sub tsttrim ($$) {
   my $dom = shift;
   my $want = shift;
   my $got = Mail::SpamAssassin::Util::RegistrarBoundaries::trim_domain ($dom);
@@ -116,13 +149,13 @@
   }
 }
 
-ok (tsttrim ("foo.demon.co.uk", "foo.demon.co.uk"));
-ok (tsttrim ("bar.foo.demon.co.uk", "foo.demon.co.uk"));
-ok (tsttrim ("a.b.c.d.e.f.g.g.h.bar.foo.demon.co.uk", "foo.demon.co.uk"));
-ok (tsttrim ("de", "de"));
-ok (tsttrim ("jmason.org", "jmason.org"));
-ok (tsttrim ("localhost.jmason.org", "jmason.org"));
-ok (tsttrim ("localhost.jmason.edu.au", "jmason.edu.au"));
-ok (tsttrim ("localhost.jmason.hacked.au", "hacked.au"));
-ok (tsttrim ("localhost.jmason.edu.net", "edu.net"));
+ok tsttrim "foo.demon.co.uk", "foo.demon.co.uk";
+ok tsttrim "bar.foo.demon.co.uk", "foo.demon.co.uk";
+ok tsttrim "a.b.c.d.e.f.g.g.h.bar.foo.demon.co.uk", "foo.demon.co.uk";
+ok tsttrim "de", "de";
+ok tsttrim "jmason.org", "jmason.org";
+ok tsttrim "localhost.jmason.org", "jmason.org";
+ok tsttrim "localhost.jmason.edu.au", "jmason.edu.au";
+ok tsttrim "localhost.jmason.hacked.au", "hacked.au";
+ok tsttrim "localhost.jmason.edu.net", "edu.net";
 

Modified: spamassassin/trunk/t/rcvd_parser.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/rcvd_parser.t?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/t/rcvd_parser.t (original)
+++ spamassassin/trunk/t/rcvd_parser.t Fri Mar 14 07:55:35 2008
@@ -18,7 +18,7 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("rcvd_parser");
-use Test; BEGIN { plan tests => 131 };
+use Test; BEGIN { plan tests => 132 };
 use strict;
 
 # format is:
@@ -54,7 +54,7 @@
   '',
 
   'from rc3.isc.org (rc3.isc.org [IPv6:2001:4f8:3:bb::25])       (using TLSv1 with cipher
DHE-RSA-AES256-SHA (256/256 bits))        (No client certificate requested)  by sf1.isc.org
(Postfix) with ESMTP id C986F284EE       for <jm@jmason.org>; Sat, 16 Oct 2004 21:30:02
+0000 (UTC) (envelope-from bind-users-bounce@isc.org)' =>
-  '',
+  '[ ip=2001:4f8:3:bb::25 rdns=rc3.isc.org helo=rc3.isc.org by=sf1.isc.org ident= envfrom=bind-users-bounce@isc.org
id=C986F284EE auth= msa=0 ]',
 
   'from ausisaps301-dmz.aus.amer.dell.com ([143.166.226.16]) (SquirrelMail authenticated
user hoolis); by www.penguintowne.org with HTTP; Mon, 22 Mar 2004 12:54:13 -0600 (CST)' =>
   '',
@@ -421,6 +421,10 @@
 
   'from p5498acaa.dip0.t-ipconnect.de (HELO JIMBOBSPC) (user@84.152.172.1) by msa.example.com
with ESMTPA; 23 May 2007 15:05:04 -0000' =>
   '[ ip=84.152.172.1 rdns=p5498acaa.dip0.t-ipconnect.de helo=JIMBOBSPC by=msa.example.com
ident=user envfrom= id= auth=ESMTPA msa=0 ]',
+
+  # bug 5512
+  'from ([89.79.20.16]) by pop3.m80.net with MailEnable ESMTP; Tue, 20 Feb 2007 09:26:17
-0500' =>
+  '[ ip=89.79.20.16 rdns= helo= by=pop3.m80.net ident= envfrom= id= auth= msa=0 ]'
 
 );
 

Modified: spamassassin/trunk/t/trust_path.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/trust_path.t?rev=637123&r1=637122&r2=637123&view=diff
==============================================================================
--- spamassassin/trunk/t/trust_path.t (original)
+++ spamassassin/trunk/t/trust_path.t Fri Mar 14 07:55:35 2008
@@ -18,7 +18,7 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("trust_path");
-use Test; BEGIN { plan tests => 81 };
+use Test; BEGIN { plan tests => 96 };
 use IO::File;
 
 use strict;
@@ -512,6 +512,83 @@
 },
 
 # ---------------------------------------------------------------------------
+# IPv6
+
+q{
+
+  trusted_networks DEAD:BEEF:0000:0102:0304:0506:0708:0a0b
+  Received: from sender.net (sender.net [DEAD:BEEF:0000:0102:0304:0506:0708:0a0b])
+        by receiver.net (Postfix) with ESMTP id A96E18BD97
+
+} => q{
+
+Trusted: [ ip=DEAD:BEEF:0000:0102:0304:0506:0708:0a0b rdns=sender.net helo=sender.net by=receiver.net
ident= envfrom= intl=1 id=A96E18BD97 auth= msa=0 ]
+Untrusted:
+
+},
+
+# ---------------------------------------------------------------------------
+# bug 4503
+
+q{
+
+  trusted_networks DEAD:BEEF:0000:0102:0304:0506:0708:0a0b
+  Received: from sender.net (sender.net [IPv6:2002:abcd:ef10::1])
+        by receiver.net (Postfix) with ESMTP id A96E18BD97
+
+} => q{
+
+Trusted: 
+Untrusted: [ ip=2002:abcd:ef10::1 rdns=sender.net helo=sender.net by=receiver.net ident=
envfrom= intl=0 id=A96E18BD97 auth= msa=0 ]
+
+},
+
+# ---------------------------------------------------------------------------
+
+# ::1 implicitly trusted as default
+q{
+
+  Received: from sender.net (::1) by receiver.net
+              with SMTP; 10 Nov 2005 00:00:00 -0000
+
+} => q{
+
+Trusted: [ ip=::1 rdns=sender.net helo=sender.net by=receiver.net ident= envfrom= intl=1
id= auth= msa=0 ]
+Untrusted: 
+
+},
+
+# ---------------------------------------------------------------------------
+
+q{
+
+  trusted_networks DEAD:BEEF:0000:0102:0304:0506:0708:0000/108
+  Received: from sender.net (sender.net [DEAD:BEEF:0000:0102:0304:0506:0708:0a0b])
+        by receiver.net (Postfix) with ESMTP id A96E18BD97
+
+} => q{
+
+Trusted: [ ip=DEAD:BEEF:0000:0102:0304:0506:0708:0a0b rdns=sender.net helo=sender.net by=receiver.net
ident= envfrom= intl=1 id=A96E18BD97 auth= msa=0 ]
+Untrusted:
+
+},
+
+# ---------------------------------------------------------------------------
+
+q{
+
+  trusted_networks DEAD:BEEF:0000:0102:0304:0506:0708:0a0c
+  Received: from sender.net (sender.net [DEAD:BEEF:0000:0102:0304:0506:0708:0a0b])
+        by receiver.net (Postfix) with ESMTP id A96E18BD97
+
+} => q{
+
+Trusted:
+Untrusted: [ ip=DEAD:BEEF:0000:0102:0304:0506:0708:0a0b rdns=sender.net helo=sender.net by=receiver.net
ident= envfrom= intl=0 id=A96E18BD97 auth= msa=0 ]
+
+},
+
+# ---------------------------------------------------------------------------
 
 );
 
@@ -552,7 +629,10 @@
     print "[netset warning expected here...]\n";
   }
 
-  my $sa = create_saobj({ userprefs_filename => "log/tst.cf" });
+  my $sa = create_saobj({
+              userprefs_filename => "log/tst.cf",
+              # debug => 1
+            });
   ok($sa);
 
   $sa->{lint_callback} = sub {



Mime
View raw message