diff options
Diffstat (limited to 'mail/ricochet/files/patch-ricochet')
-rw-r--r-- | mail/ricochet/files/patch-ricochet | 190 |
1 files changed, 0 insertions, 190 deletions
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 -- |