diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 2003-06-24 19:03:05 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 2003-06-24 19:03:05 +0000 |
commit | 63d9c44846c38ba244f8b314714088f3cbaf0074 (patch) | |
tree | 8b1b1eb4d4b8c2771d546ff3393fd823590f4540 | |
parent | Add "test" target to exercise regression tests; from NetBSD. (diff) |
Upgrade to 0.98
(all my patches integrated by developer)
Notes
Notes:
svn path=/head/; revision=83541
-rw-r--r-- | mail/ricochet/Makefile | 4 | ||||
-rw-r--r-- | mail/ricochet/files/patch-ricochet | 190 |
2 files changed, 2 insertions, 192 deletions
diff --git a/mail/ricochet/Makefile b/mail/ricochet/Makefile index 7524b529a092..f4ad0e514f04 100644 --- a/mail/ricochet/Makefile +++ b/mail/ricochet/Makefile @@ -6,8 +6,7 @@ # PORTNAME= ricochet -PORTVERSION= 0.97 -PORTREVISION= 9 +PORTVERSION= 0.98 CATEGORIES= mail MASTER_SITES= http://vipul.net/perl/sources/spamcontrol/ricochet/ @@ -21,6 +20,7 @@ RUN_DEPENDS= ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/Mail/Internet.pm:${POR ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}/LWP/UserAgent.pm:${PORTSDIR}/www/p5-libwww NO_BUILD= yes +NO_WRKSUBDIR= yes PERL_CONFIGURE= yes do-configure: diff --git a/mail/ricochet/files/patch-ricochet b/mail/ricochet/files/patch-ricochet index 024202c379bf..3ae0516ebacd 100644 --- a/mail/ricochet/files/patch-ricochet +++ b/mail/ricochet/files/patch-ricochet @@ -1,133 +1,5 @@ --- ricochet.orig Thu Feb 8 22:23:19 2001 +++ ricochet Tue Jun 24 18:14:09 2003 -@@ -128,7 +128,10 @@ - ## List of receipients at ORIG_DOMAN - ## besides the CONTACTS. - -- EXTRA_HEADERS => [qw/from reply-to sender errors-to return-path/], -+## Anything there can be easily faked, producing lots of unwanted -+## complaints. Better will not use it. -+## EXTRA_HEADERS => [qw/from reply-to sender errors-to return-path/], -+ EXTRA_HEADERS => undef, - ## Headers to analyze besides - ## 'Received' - -@@ -227,13 +230,19 @@ - - - $self->debug (0, "\nANALYZING HEADERS...\n"); -+ my $ip = $header->get ('X-Originating-IP'); - grep { - my $header_text = $_; - my $hdata = $header->get ($header_text); - unless ($hdata eq '') { - $hdata =~ s/\n*$//; - $self->debug (1,"o [$_] -- $hdata"); -- my $host = _host ($hdata); my ($NS, $MX); -+ my $host = _host ($hdata); -+ if ($host =~ /^(.*\.)?hotmail\.(msn\.)?com$/i && $ip eq '') { -+ $self->debug (2,"- FAKE hotmail.com, NO X-Originating-IP.\n"); -+ goto EXTFAKE; -+ } -+ my ($NS, $MX); - if ((_nslookup ($host) && ($NS = 1)) || (_mxlookup ($host) && ($MX = 1))) { - $self->debug (2,"+ $host EXISTS.\n") if $NS; - $self->debug (2,"+ $host HAS A MX RECORD.\n") if $MX; -@@ -244,6 +253,7 @@ - } - } else { $self->debug (2,"- POSSIBLY FAKED HEADER. $host DOESN'T EXIST.\n") } - } -+EXTFAKE: - } @{$self->{EXTRA_HEADERS}}; - - while ($match == 0) { -@@ -379,7 +389,7 @@ - ## --------------------------------------------------------------------------- - - sub authentic { -- my $HOSTRE = '[\dA-Za-z\-\.]+\.[A-Za-z]{2,3}(?=[^A-Za-z\-\d])'; -+ my $HOSTRE = '[\dA-Za-z\-\.]+\.[A-Za-z]{2,4}(?=[^A-Za-z\-\d])'; - my $IPRE = '\d{1,3}\.\d{1,3}\.\d{1,3}.\d{1,3}'; - - my ($self, $received) = @_; -@@ -401,13 +411,24 @@ - - $received =~ /from\s(.*?)$rfc/s; my $from = " $1 "; - $received =~ /by\s(.*?)$rfc/s; my $by = " $1 "; -- my @orig_hosts = $from =~ /($HOSTRE)/gs; -- my @orig_ips = $from =~ /($IPRE)/gs; -- my @transmit_hosts = $by =~ /($HOSTRE)/gs; - -+ ## Trust only "(host.name [" part, HELO can be fake -+ my @orig_hosts = $from =~ /\([^()\[\]]*?($HOSTRE)[^()\[\]]*?\[/gs; -+ my @orig_ips = $from =~ /\[($IPRE)\]/gs; -+ if ($#orig_ips == -1) { -+ # check it last because of "(1.2.3.4) [2.3.4.5]" -+ @orig_ips = $from =~ /\(($IPRE)\)/gs; -+ } -+ my @transmit_hosts = $by =~ /($HOSTRE)/gs; - my @ips = $by =~ /($IPRE)/gs; -+ -+ my $header = $self->{MAIL}->head; -+ my $ip = $header->get ('X-Originating-IP'); -+ - grep { -- if (_nslookup ($_)) { -+ if (/^(.*\.)?hotmail\.(msn\.)?com$/i && $ip eq '') { -+ $self->debug (2, "- FAKE originating hotmail.com, NO X-Originating-IP."); -+ } elsif (_nslookup ($_)) { - $auth = 1; - $self->{ORIG_HOSTS}->add ($_); - $self->debug (2,"+ $_ EXISTS."); -@@ -417,15 +438,21 @@ - my $host; - grep { - if ($host = _ptrquery ($_)) { -- $auth = 1; - $self->debug (2,"+ $_ RESOLVES TO $host."); -- $self->{ORIG_HOSTS}->add ($host); -+ if ($host =~ /^(.*\.)?hotmail\.(msn\.)?com$/i && $ip eq '') { -+ $self->debug (2, "- FAKE originating IP of hotmail.com, NO X-Originating-IP."); -+ } else { -+ $auth = 1; -+ $self->{ORIG_HOSTS}->add ($host); -+ } - } - } @orig_ips; - - if ($self->relaxed == 1) { ## Check the transmit headers too. - grep { -- if (_nslookup ($_)) { -+ if (/^(.*\.)?hotmail\.(msn\.)?com$/i && $ip eq '') { -+ $self->debug (2, "- FAKE transmitting hotmail.com, NO X-Originating-IP."); -+ } elsif (_nslookup ($_)) { - $auth = 1; - $self->{TRANSMIT_HOSTS}->add ($_); - $self->debug (2,"+ $_ EXISTS."); -@@ -439,7 +466,13 @@ - } - - unless ($self->relaxed == 1) { -- $self->{TRANSMIT_HOSTS}->add (@transmit_hosts); -+ grep { -+ if (/^(.*\.)?hotmail\.(msn\.)?com$/i && $ip eq '') { -+ $self->debug (2, "- FAKE transmitting hotmail.com, NO X-Originating-IP."); -+ } else { -+ $self->{TRANSMIT_HOSTS}->add ($_); -+ } -+ } @transmit_hosts; - } - - $self->debug (2, "+ Seems Authentic.\n"); -@@ -464,7 +497,7 @@ - my $email = $header->get ($_); chomp $email; - $email = _email ($email); - my $host = _host ($email); -- $self->{CONTACTS}->add ($email) if $email; -+ $self->{CONTACTS}->add ($email) if ($email && $host); - } @{$self->{EXTRA_EMAIL_HEADERS}}; - } - @@ -574,7 +607,8 @@ sub initialize { @@ -138,65 +10,3 @@ Carp::croak "** Ricochet configuration file $rc doesn't exist. Aborting.\n" unless -e $rc; open (RC, $rc); grep { -@@ -639,7 +673,6 @@ - my ($cinfo, $list, @mails, %mailhash, $add); - - $domainname = _domain ($domainname); -- $domainname =~ y/A-Z/a-z/; - - $level = 0 unless $level; - -@@ -756,10 +789,37 @@ - ## FUNCTION Returns the domain part of the host. - ## --------------------------------------------------------------------------- - -+my @geo_rusu = ( -+'adygeya','altai','amur','amursk','arkhangelsk','astrakhan','baikal', -+'bashkiria','belgorod','bir','bryansk','buryatia','cbg','chel','chelyabinsk', -+'chita','chukotka','chuvashia','cmw','dagestan','dudinka','e-burg','fareast', -+'grozny','irkutsk','ivanovo','izhevsk','jamal','jar','joshkar-ola','k-uralsk', -+'kalmykia','kaluga','kamchatka','karelia','kazan','kchr','kemerovo', -+'khabarovsk','khakassia','khv','kirov','kms','koenig','komi','kostroma', -+'krasnoyarsk','kuban','kurgan','kursk','kustanai','kuzbass','lipetsk', -+'magadan','magnitka','mari-el','mari','marine','mordovia','mosreg','msk', -+'murmansk','mytis','nakhodka','nalchik','nkz','nnov','norilsk','nov', -+'novosibirsk','nsk','omsk','orenburg','oryol','oskol','palana','penza','perm', -+'pskov','ptz','pyatigorsk','rnd','rubtsovsk','ryazan','sakhalin','samara', -+'saratov','simbirsk','smolensk','snz','spb','stavropol','stv','surgut', -+'syzran','tambov','tatarstan','tom','tomsk','tsaritsyn','tsk','tula','tuva', -+'tver','tyumen','udm','udmurtia','ulan-ude','vdonsk','vladikavkaz','vladimir', -+'vladivostok','volgograd','vologda','voronezh','vrn','vyatka','yakutia', -+'yamal','yaroslavl','yekaterinburg','yuzhno-sakhalinsk','zgrad' -+); -+ - sub _domain { - my $host = shift; $host =~ y/A-Z/a-z/; my $domain = ''; -- ($domain) = $host =~ /([\da-z\-]+\.[a-z]{2,3}\.[a-z]{2})$/; -- ($domain) = $host =~ /([\da-z\-]+\.[a-z]{2,3})$/ unless $domain; -+ return undef if ($host =~ /\.in-addr\.arpa$/); -+ ($domain) = $host =~ /([\da-z\-]+\.(kiev|kharkiv|dp|zp)\.ua)$/; -+ ($domain) = $host =~ /([\da-z\-]+\.(edu?|com?|net?|org?|gov?|int|ac|pp)\.[a-z]{2})$/ unless $domain; -+ if (!$domain && $host =~ /\.[rs]u$/) { -+ for (@geo_rusu) { -+ ($domain) = $host =~ /([\da-z\-]+\.$_\.[rs]u)$/; -+ last if ($domain); -+ } -+ } -+ ($domain) = $host =~ /([\da-z\-]+\.[a-z]{2,4})$/ unless $domain; - return $domain ? $domain : undef; - } - -@@ -769,10 +829,11 @@ - ## --------------------------------------------------------------------------- - - sub _host { -- my $hostre = '[\dA-Za-z\-\.]+\.[A-Za-z]{2,3}(?=[^A-Za-z\-\d]|$)'; -+ my $hostre = '[\dA-Za-z\-\.]+\.[A-Za-z]{2,4}(?=[^A-Za-z\-\d]|$)'; - my $data = shift; - my ($host) = $data =~ /($hostre)/; -- return $host if $host ne ''; -+ return undef if ($host =~ /\.in-addr\.arpa$/); -+ return $host ? $host : undef; - } - - ## -- SUBROUTINE _email () -------------------------------------- INTERNAL -- |