Mailing List Archive

svn commit: rev 6782 - in incubator/spamassassin/trunk: . lib/Mail lib/Mail/SpamAssassin
Author: jm
Date: Thu Feb 19 14:56:34 2004
New Revision: 6782

Modified:
incubator/spamassassin/trunk/MANIFEST
incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm
incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
Log:
did I check in?

Modified: incubator/spamassassin/trunk/MANIFEST
==============================================================================
--- incubator/spamassassin/trunk/MANIFEST (original)
+++ incubator/spamassassin/trunk/MANIFEST Thu Feb 19 14:56:34 2004
@@ -40,6 +40,7 @@
lib/Mail/SpamAssassin/Conf.pm
lib/Mail/SpamAssassin/ConfSourceLDAP.pm
lib/Mail/SpamAssassin/ConfSourceSQL.pm
+lib/Mail/SpamAssassin/Constants.pm
lib/Mail/SpamAssassin/DBBasedAddrList.pm
lib/Mail/SpamAssassin/Dns.pm
lib/Mail/SpamAssassin/EvalTests.pm

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin.pm Thu Feb 19 14:56:34 2004
@@ -64,6 +64,7 @@

require 5.006_001;

+use Mail::SpamAssassin::Constants;
use Mail::SpamAssassin::Conf;
use Mail::SpamAssassin::ConfSourceSQL;
use Mail::SpamAssassin::ConfSourceLDAP;

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Dns.pm Thu Feb 19 14:56:34 2004
@@ -31,8 +31,7 @@
use Carp;

use vars qw{
- $KNOWN_BAD_DIALUP_RANGES $IP_IN_RESERVED_RANGE
- @EXISTING_DOMAINS $IS_DNS_AVAILABLE $VERSION
+ $KNOWN_BAD_DIALUP_RANGES @EXISTING_DOMAINS $IS_DNS_AVAILABLE $VERSION
};

# don't lookup SpamAssassin.org -- use better-connected sites
@@ -52,51 +51,6 @@
gwdg.de
};

-# Initialize a regexp for reserved IPs, i.e. ones that could be
-# used inside a company and be the first or second relay hit by
-# a message. Some companies use these internally and translate
-# them using a NAT firewall. These are listed in the RBL as invalid
-# originators -- which is true, if you receive the mail directly
-# from them; however we do not, so we should ignore them.
-# cf. <http://www.iana.org/assignments/ipv4-address-space>,
-# <http://duxcw.com/faq/network/privip.htm>,
-# <http://duxcw.com/faq/network/autoip.htm>,
-# <ftp://ftp.rfc-editor.org/in-notes/rfc3330.txt>
-#
-# Last update
-# 2003-11-07 bug 1784 changes removed due to relicensing
-# 2003-04-15 Updated - bug 1784
-# 2003-04-07 Justin Mason - removed some now-assigned nets
-# 2002-08-24 Malte S. Stretz - added 172.16/12, 169.254/16
-# 2002-08-23 Justin Mason - added 192.168/16
-# 2002-08-12 Matt Kettler - mail to SpamAssassin-devel
-# msgid:<5.1.0.14.0.20020812211512.00a33cc0@192.168.50.2>
-#
-# REIMPLEMENT: This needs to be extended to re-include the ranges
-# from the RFCs and documents above.
-#
-$IP_IN_RESERVED_RANGE = qr{^(?:
- 192\.168| # 192.168/16: Private Use
- 10| # 10/8: Private Use
- 172\.(?:1[6-9]|2[0-9]|3[01])| # 172.16-172.31/16: Private Use
- 169\.254| # 169.254/16: Private Use (APIPA)
- 127| # 127/8: Private Use (localhost)
- [01257]| # 000-002/8, 005/8, 007/8: Reserved
- 2[37]| # 023/8, 027/8: Reserved
- 3[179]| # 031/8, 037/8, 039/8: Reserved
- 4[12]| # 041/8, 042/8: Reserved
- 5[89]| # 058/8, 059/8: Reserved
- 60| # 060/8: Reserved
- 7[0-9]| # 070-079/8: Reserved
- 9[0-9]| # -
- 1[01][0-9]| # -
- 12[0-6]| # 126/8: Reserved
- 197| # 197/8: Reserved
- 22[23]| # 222/8, 223/8: Reserved
- 24[0-9]| # 240-
- 25[0-5] # 255/8: Reserved
-)\.}x;
-
$IS_DNS_AVAILABLE = undef;

$VERSION = 'bogus'; # avoid CPAN.pm picking up razor ver
@@ -1008,7 +962,7 @@
return undef;
}

- if ($dom =~ /^${IP_IN_RESERVED_RANGE}/) {
+ if ($dom =~ /^${Mail::SpamAssassin::IP_IN_RESERVED_RANGE}/) {
dbg ("IP is reserved, not looking up PTR");
return undef;
}

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Thu Feb 19 14:56:34 2004
@@ -38,7 +38,6 @@
use constant HAS_DB_FILE => eval { require DB_File; };

use vars qw{
- $IP_ADDRESS $IPV4_ADDRESS
$CCTLDS_WITH_LOTS_OF_OPEN_RELAYS
$ROUND_THE_WORLD_RELAYERS
$WORD_OBFUSCATION_CHARS
@@ -65,27 +64,6 @@
# for figuring this. any ccTLD with > about 40000 domains is left out of this
# regexp. Then I threw in some unscientific seasoning to taste. ;)

-# an IP address, in IPv4 format only.
-$IPV4_ADDRESS = qr/\b(?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)
- \b/x;
-
-# an IP address, in IPv4, IPv4-mapped-in-IPv6, or IPv6 format. NOTE: cannot
-# just refer to $IPV4_ADDRESS, due to perl bug reported in nesting qr//s. :(
-#
-$IP_ADDRESS = qr/\b (?:IPv6:|) (?: (?:0*:0*:ffff:(?:0*:|)|) # IPv4-mapped-in-IPv6
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
- (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)
- | # an IPv6 address, seems to always be at least 6 words
- [a-f0-9]{0,4} \:[a-f0-9]{0,4}
- \:[a-f0-9]{0,4} \:[a-f0-9]{0,4}
- \:[a-f0-9]{0,4} \:[a-f0-9]{0,4} (?:\:[a-f0-9]{0,4})*
- )\b/ix;
-
$WORD_OBFUSCATION_CHARS = '*_.,/|-+=';

# Charsets which use capital letters heavily in their encoded representation.
@@ -436,7 +414,7 @@
# allow private IP addrs here, could be a legit screwup
if ($hclassb && $fclassb &&
$hclassb ne $fclassb &&
- !($hlo =~ /${IP_IN_RESERVED_RANGE}/o))
+ !($hlo =~ /${Mail::SpamAssassin::IP_IN_RESERVED_RANGE}/o))
{
dbg ("forged-HELO: massive mismatch on IP-addr HELO: '$hlo' != '$fip'");
$self->{mismatch_ip_helo}++;
@@ -494,7 +472,7 @@
/from mail pickup service by hotmail\.com with Microsoft SMTPSVC;/);

my $ip = $self->get ('X-Originating-Ip');
- if ($ip =~ /$IP_ADDRESS/) { $ip = 1; } else { $ip = 0; }
+ if ($ip =~ /${Mail::SpamAssassin::IP_ADDRESS}/) { $ip = 1; } else { $ip = 0; }

# Hotmail formats its received headers like this:
# Received: from hotmail.com (f135.law8.hotmail.com [216.33.241.135])
@@ -577,7 +555,7 @@
$rcvd =~ s/\s+/ /gs; # just spaces, simplify the regexp

my $ip = $self->get ('X-Sender-Ip');
- if ($ip =~ /$IP_ADDRESS/) { $ip = 1; } else { $ip = 0; }
+ if ($ip =~ /${Mail::SpamAssassin::IP_ADDRESS}/) { $ip = 1; } else { $ip = 0; }

# Eudoramail formats its received headers like this:
# Received: from Unknown/Local ([?.?.?.?]) by shared1-mail.whowhere.com;
@@ -647,7 +625,7 @@
if ($rcvd =~ /by web\S+\.mail\.yahoo\.com via HTTP/) { return 0; }
if ($rcvd =~ /by smtp\S+\.yahoo\.com with SMTP/) { return 0; }
if ($rcvd =~
- /from \[$IP_ADDRESS\] by \S+\.(?:groups|grp\.scd)\.yahoo\.com with NNFMP/) {
+ /from \[${Mail::SpamAssassin::IP_ADDRESS}\] by \S+\.(?:groups|grp\.scd)\.yahoo\.com with NNFMP/) {
return 0;
}

@@ -683,12 +661,12 @@
my $rcvd = $self->get('Received');

if (!$xorig) { # New style Juno has no X-Originating-IP header, and other changes
- if($rcvd !~ /from.*\b(?:juno|untd)\.com.*[\[\(]$IP_ADDRESS[\]\)].*by/
+ if($rcvd !~ /from.*\b(?:juno|untd)\.com.*[\[\(]${Mail::SpamAssassin::IP_ADDRESS}[\]\)].*by/
&& $rcvd !~ / cookie\.(?:juno|untd)\.com /) { return 1; }
if($xmailer !~ /Juno /) { return 1; }
} else {
- if($rcvd !~ /from.*\bmail\.com.*\[$IP_ADDRESS\].*by/) { return 1; }
- if($xorig !~ /$IP_ADDRESS/) { return 1; }
+ if($rcvd !~ /from.*\bmail\.com.*\[${Mail::SpamAssassin::IP_ADDRESS}\].*by/) { return 1; }
+ if($xorig !~ /${Mail::SpamAssassin::IP_ADDRESS}/) { return 1; }
if($xmailer !~ /\bmail\.com/) { return 1; }
}

@@ -1301,7 +1279,7 @@
for my $header ('X-Originating-IP', 'X-Apparently-From') {
my $str = $self->get($header);
next unless defined $str;
- push (@originating, ($str =~ m/($IP_ADDRESS)/g));
+ push (@originating, ($str =~ m/(${Mail::SpamAssassin::IP_ADDRESS})/g));
}

# Let's go ahead and trim away all Reserved ips (KLC)
@@ -1441,7 +1419,7 @@
foreach my $ip (@origips) {
next unless $ip;
next if (exists ($seen{$ip})); $seen{$ip} = 1;
- next if ($ip =~ /${IP_IN_RESERVED_RANGE}/o);
+ next if ($ip =~ /${Mail::SpamAssassin::IP_IN_RESERVED_RANGE}/o);
push(@ips, $ip);
}
return @ips;
@@ -1755,7 +1733,7 @@
# Fri, 30 Nov 2001 08:57:47 +1000
if ($rcvd =~ /
\nfrom\b.{0,20}\s(\S+\.${CCTLDS_WITH_LOTS_OF_OPEN_RELAYS})\s\(.{0,200}
- \nfrom\b.{0,20}\s([-_A-Za-z0-9.]+)\s.{0,30}\[($IPV4_ADDRESS)\]
+ \nfrom\b.{0,20}\s([-_A-Za-z0-9.]+)\s.{0,30}\[(${Mail::SpamAssassin::IPV4_ADDRESS})\]
/osix) { $relay = $1; $relayer = $2; $relayerip = $3; goto gotone; }

return 0;
@@ -2271,15 +2249,16 @@
# more than 0.02% false positives. only used for text < 2048 bytes in
# length
my %mistakable = ('sco' => 'en');
+ my $len = $self->{msg}->{metadata}->{languages_body_len};

# see if any matches are okay
foreach my $match (@matches) {
$match =~ s/\..*//;
- if ($self->{languages_body_len} < 2048 && exists $mistakable{$match}) {
+ if ($len < 2048 && exists $mistakable{$match}) {
$match = $mistakable{$match};
}
foreach my $language (@languages) {
- if ($self->{languages_body_len} < 2048 && exists $mistakable{$language}) {
+ if ($len < 2048 && exists $mistakable{$language}) {
$language = $mistakable{$language};
}
if ($match eq $language) {
@@ -3173,7 +3152,7 @@

if ($numparts > 0) {
my $partsreqd = 2;
- if (Mail::SpamAssassin::PerMsgStatus::is_in_subdelegated_cctld ($helo)) {
+ if (Mail::SpamAssassin::Util::is_in_subdelegated_cctld ($helo)) {
$partsreqd = 3;
}


Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MsgContainer.pm Thu Feb 19 14:56:34 2004
@@ -620,6 +620,9 @@

sub get_metadata {
my ($self, $hdr) = @_;
+ if (!$self->{metadata}) {
+ warn "oops! get_metadata() called after finish_metadata()"; return;
+ }
$self->{metadata}->{strings}->{$hdr};
}

@@ -629,6 +632,9 @@

sub put_metadata {
my ($self, $hdr, $text) = @_;
+ if (!$self->{metadata}) {
+ warn "oops! put_metadata() called after finish_metadata()"; return;
+ }
$self->{metadata}->{strings}->{$hdr} = $text;
}

@@ -638,6 +644,9 @@

sub delete_metadata {
my ($self, $hdr) = @_;
+ if (!$self->{metadata}) {
+ warn "oops! delete_metadata() called after finish_metadata()"; return;
+ }
delete $self->{metadata}->{strings}->{$hdr};
}

@@ -648,6 +657,9 @@
sub get_all_metadata {
my ($self) = @_;

+ if (!$self->{metadata}) {
+ warn "oops! get_all_metadata() called after finish_metadata()"; return;
+ }
my @ret = ();
foreach my $key (sort keys %{$self->{metadata}->{strings}}) {
push (@ret, $key, ": ", $self->{metadata}->{strings}->{$key}, "\n");
@@ -667,7 +679,7 @@

sub finish_metadata {
my ($self) = @_;
- if ($self->{metadata}) {
+ if (defined ($self->{metadata})) {
$self->{metadata}->finish();
delete $self->{metadata};
}

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Thu Feb 19 14:56:34 2004
@@ -223,6 +223,10 @@
$self->{report} = $report;

$self->{main}->call_plugins ("check_end", { permsgstatus => $self });
+
+ # tell the message object to clean up its metadata, we won't need
+ # it any more
+ $self->{msg}->finish_metadata();
}

###########################################################################
@@ -971,10 +975,6 @@
$self->{main}->call_plugins ("per_msg_finish", {
permsgstatus => $self
});
-
- # tell the message object to clean up its metadata, we won't need
- # it any more
- $self->{msg}->finish_metadata();

delete $self->{main};
delete $self->{msg};

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm Thu Feb 19 14:56:34 2004
@@ -49,29 +49,8 @@
use Mail::SpamAssassin::PerMsgStatus;

use vars qw{
- $LOCALHOST $CCTLDS_WITH_SUBDELEGATION $IP_ADDRESS $IPV4_ADDRESS
- $IP_IN_RESERVED_RANGE
};

-$IPV4_ADDRESS = $Mail::SpamAssassin::PerMsgStatus::IPV4_ADDRESS;
-$IP_ADDRESS = $Mail::SpamAssassin::PerMsgStatus::IP_ADDRESS;
-$IP_IN_RESERVED_RANGE = $Mail::SpamAssassin::PerMsgStatus::IP_IN_RESERVED_RANGE;
-
-$LOCALHOST = qr{(?:
- localhost(?:\.localdomain|)|
- 127\.0\.0\.1|
- ::ffff:127\.0\.0\.1
- )}ixo;
-
-# http://www.bestregistrar.com/help/ccTLD.htm lists these
-$CCTLDS_WITH_SUBDELEGATION = qr{
- (?:ac| ae| ar| at| au| az| bb| bm| br| bs| ca| cn| co|
- cr| cu| cy| do| ec| eg| fj| ge| gg| gu| hk| hu| id| il| im|
- in| je| jo| jp| kr| la| lb| lc| lv| ly| mm| mo| mt| mx| my|
- na| nc| np| nz| pa| pe| ph| pl| py| ru| sg| sh| sv| sy| th|
- tn| tr| tw| ua| ug| uk| uy| ve| vi| yu| za)
-}ixo;
-
# Should trust be computed based on the MX records of hostnames used in
# HELO? Disabled; too slow.
use constant SLOW_TRUST_BASED_ON_HELO_MXES => 0;
@@ -95,7 +74,7 @@

# urgh, droppings. TODO: move into loop below?
$hdrs =~ s/\n
- Received:\ from\ \S*hotmail\.com\ \(\[${IP_ADDRESS}\]\)\
+ Received:\ from\ \S*hotmail\.com\ \(\[${Mail::SpamAssassin::IP_ADDRESS}\]\)\
by\ \S+\.hotmail.com with\ Microsoft\ SMTPSVC\(5\.0\.\S+\);
\ \S+,\ \S+\ \S+\ \d{4}\ \d{2}:\d{2}:\d{2}\ \S+\n
/\n/gx;
@@ -242,9 +221,9 @@
my $found_non_rsvd = 0;
my $found_rsvd = 0;
foreach my $ip (@ips) {
- next if ($ip =~ /^${LOCALHOST}$/o);
+ next if ($ip =~ /^${Mail::SpamAssassin::LOCALHOST}$/o);

- if ($ip !~ /${IP_IN_RESERVED_RANGE}/o) {
+ if ($ip !~ /${Mail::SpamAssassin::IP_IN_RESERVED_RANGE}/o) {
dbg ("received-header: 'by' ".$relay->{by}." has public IP $ip");
$found_non_rsvd = 1;
} else {
@@ -361,42 +340,6 @@
return @ips;
}

-sub ips_match_in_16_mask {
- my ($self, $ipset1, $ipset2) = @_;
- my ($b1, $b2);
-
- foreach my $ip1 (@{$ipset1}) {
- foreach my $ip2 (@{$ipset2}) {
- next unless defined $ip1;
- next unless defined $ip2;
- next unless ($ip1 =~ /^(\d+\.\d+\.)/); $b1 = $1;
- next unless ($ip2 =~ /^(\d+\.\d+\.)/); $b2 = $1;
-
- if ($b1 eq $b2) { return 1; }
- }
- }
-
- return 0;
-}
-
-sub ips_match_in_24_mask {
- my ($self, $ipset1, $ipset2) = @_;
- my ($b1, $b2);
-
- foreach my $ip1 (@{$ipset1}) {
- foreach my $ip2 (@{$ipset2}) {
- next unless defined $ip1;
- next unless defined $ip2;
- next unless ($ip1 =~ /^(\d+\.\d+\.\d+\.)/); $b1 = $1;
- next unless ($ip2 =~ /^(\d+\.\d+\.\d+\.)/); $b2 = $1;
-
- if ($b1 eq $b2) { return 1; }
- }
- }
-
- return 0;
-}
-
sub mx_of_helo_near_ip {
my ($self, $helo, $ip) = @_;

@@ -405,8 +348,8 @@
# TODO: should we just traverse down the chain instead of this;
# e.g. "foo.bar.baz.co.uk" would be "bar.baz.co.uk", "baz.co.uk",
# instead of just "baz.co.uk" straight away?
- if ($helo =~ /\.${CCTLDS_WITH_SUBDELEGATION}$/) {
- if ($helo =~ /\.([^\.]+\.[^\.]+\.${CCTLDS_WITH_SUBDELEGATION})$/) {
+ if (Mail::SpamAssassin::Util::is_in_subdelegated_cctld ($helo)) {
+ if ($helo =~ /\.([^\.]+\.[^\.]+\.[^\.]+)$/) {
$helodomain = $1;
}
} else {
@@ -443,6 +386,7 @@
my $ident = '';
my $envfrom = '';
my $mta_looked_up_dns = 0;
+ my $IP_ADDRESS = $Mail::SpamAssassin::IP_ADDRESS;

# Received: (qmail 27981 invoked by uid 225); 14 Mar 2003 07:24:34 -0000
# Received: (qmail 84907 invoked from network); 13 Feb 2003 20:59:28 -0000
@@ -973,11 +917,11 @@
# with SMTP id h2R2iivG093740; Wed, 26 Mar 2003 20:44:44 -0600
# (CST) (envelope-from x@x.org)
# Received: from localhost (localhost [127.0.0.1]) (uid 500) by mail with local; Tue, 07 Jan 2003 11:40:47 -0600
- if (/^from ${LOCALHOST} \((?:\S+\@|)${LOCALHOST}[\) ]/) { return; }
+ if (/^from ${Mail::SpamAssassin::LOCALHOST} \((?:\S+\@|)${Mail::SpamAssassin::LOCALHOST}[\) ]/) { return; }

# Received: from olgisoft.com (127.0.0.1) by 127.0.0.1 (EzMTS MTSSmtp
# 1.55d5) ; Thu, 20 Mar 03 10:06:43 +0100 for <asrg@ietf.org>
- if (/^from \S+ \((?:\S+\@|)${LOCALHOST}\) /) { return; }
+ if (/^from \S+ \((?:\S+\@|)${Mail::SpamAssassin::LOCALHOST}\) /) { return; }

# Received: from casper.ghostscript.com (raph@casper [127.0.0.1]) h148aux8016336verify=FAIL); Tue, 4 Feb 2003 00:36:56 -0800
# TODO: could use IPv6 localhost
@@ -1123,7 +1067,7 @@
dbg ("received-header: parsed as $asstr");
$relay->{as_string} = $asstr;

- my $isrsvd = ($ip =~ /${IP_IN_RESERVED_RANGE}/o);
+ my $isrsvd = ($ip =~ /${Mail::SpamAssassin::IP_IN_RESERVED_RANGE}/o);
$relay->{ip_is_reserved} = $isrsvd;

# add it to an internal array so Eval tests can use it
@@ -1136,11 +1080,6 @@
my ($self) = @_;
dbg ("found fetchmail marker, restarting parse");
$self->{relays} = [ ];
-}
-
-sub is_in_subdelegated_cctld {
- my ($domain) = @_;
- return ($domain =~ /\.${CCTLDS_WITH_SUBDELEGATION}$/);
}

sub dbg { Mail::SpamAssassin::dbg(@_); }

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Thu Feb 19 14:56:34 2004
@@ -41,6 +41,8 @@
use Sys::Hostname (); # don't import hostname() into this namespace!
use Fcntl;

+###########################################################################
+
use constant HAS_MIME_BASE64 => eval { require MIME::Base64; };
use constant RUNNING_ON_WINDOWS => ($^O =~ /^(?:mswin|dos|os2)/oi);

@@ -699,6 +701,21 @@
umask $umask;

return ($reportfile, \*TMPFILE);
+}
+
+###########################################################################
+
+sub is_in_subdelegated_cctld {
+ my ($domain) = @_;
+
+ # http://www.bestregistrar.com/help/ccTLD.htm lists these
+ return ($domain =~ /\.
+ (?:ac| ae| ar| at| au| az| bb| bm| br| bs| ca| cn| co|
+ cr| cu| cy| do| ec| eg| fj| ge| gg| gu| hk| hu| id| il| im|
+ in| je| jo| jp| kr| la| lb| lc| lv| ly| mm| mo| mt| mx| my|
+ na| nc| np| nz| pa| pe| ph| pl| py| ru| sg| sh| sv| sy| th|
+ tn| tr| tw| ua| ug| uk| uy| ve| vi| yu| za)
+ $/ixo);
}

###########################################################################