#! /usr/bin/perl
#
# $Id$
-# Copyright (C) 2002-2003 Jan Kratochvil <short@ucw.cz>
+# Copyright (C) 2002-2003 Jan Kratochvil <project-PerlMail@jankratochvil.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
$Lock_pathname $PeerAddr $Socket_timeout $DB_table $DBI_database $DBI_user $DBI_pwd
$sendmail_orig @addr_addon &FromAddress @h_rcpt @h_from
%audit_profile @sms_squeezes @alternates_host @dnsbl_whitelist
+
+ $Audit $is_pgp $opt_F $procmailFROM_MAILER $store_ignore $store_ignorenewmail
+ $store_profile
);
require Mail::Alias;
-sub headerhas;
-sub store;
-sub headeris;
-sub did;
-sub dnsbl;
-sub store_muttrc_alternates;
+BEGIN {
+ for (qw(headerhas store headeris did dnsbl store_muttrc_alternates Received_for parts_linear mime_type
+ body_first mimehead razor2 header_remap)) {
+ eval 'sub '.$_.' { return ::'.$_.'(@_); }';
+ }
+ }
# perlmail-accept & perlmail-sendmail
# perlmail-sendmail
+my @lists=qw(
+ tacplus-l@disaster.com
+ gsm@sh.cvut.cz
+ linux-fsdevel@vger.kernel.org
+ n9k@pandora.cz
+ dev9k@pandora.cz
+ gsm@pandora.cz
+ ros-general@reactos.com
+ ros-kernel@reactos.com
+ ros-cvs@reactos.com
+ 4cinfo@atrey.karlin.mff.cuni.cz
+ libtool@gnu.org
+ libtool-patches@gnu.org
+ wine-license@winehq.com
+ wine-devel@winehq.com
+ wine-patches@winehq.com
+ gtk-devel-list@gnome.org
+ gnome-vfs-list@gnome.org
+ captive-announce-list@jankratochvil.net
+ captive-list@jankratochvil.net
+ captive-devel-list@jankratochvil.net
+ );
+
our $sendmail_orig=(-x ($_="/usr/sbin/sendmail-orig") ? $_ : "/usr/sbin/sendmail");
# Mail-Alias-1.12 defaults to "/etc/mail/aliases" which does not exist on RedHat sendmail-8.12.5-7
# Mail-Alias-1.12 will clutter $_ !
our $opt_F; # imported
our $is_pgp; # imported
+my %lists=map(($_=>1),@lists);
sub FromAddress
{
my($rcpt,$iserror)=@_;
'pgp-'.uc($default_key).'@jankratochvil.net',
);
}
- # !$is_pgp or fallback
+ return Mail::Address->new($phrase,'lace@jankratochvil.net') if !$lists{$rcpt->address()};
return Mail::Address->new(
$phrase,
- (!$iserror ? 'rcpt' : 'rcpterr')
+ 'rcpt'
.'-'
.(defined($rcpt->user()) ? $rcpt->user() : "NOUSER")
.".AT."
our $store_ignore; # imported
sub audit
{
+ $store_profile=undef();
# TODO: <short-m@> storage?
# never spawn new mail if FROM_MAILER
# spam honeypots
return if did sub {
local $_;
- local $store_profile="silent";
+ # Do not local $store_file as it is our-imported
+ $store_profile="silent";
store "=spam" if grep /^\Qshort\@k332.feld.cvut.cz\E/i,Received_for();
# TODO: foreign violation of RFC 822 section 4.4.4, Subject:.*Automatick.+odpov.+v.+nep.+tomnosti
store "=spam" if headeris "From",'<ghandchi@hotmail.com>';
}
store "=spam" if ($_=mimehead(body_first())->mime_attr("Content-Type.charset")) && /^big5/i;
};
+ $store_profile=undef();
# spam detection
return if did sub {
- local $store_profile="silent";
+ # Do not local $store_file as it is our-imported
+ $store_profile="silent";
local $_;
store "=spam".($_ eq 1 ? "" : ";$_") if $_=razor2();
};
+ $store_profile=undef();
return if did sub {
- local $store_profile="silent";
+ # Do not local $store_file as it is our-imported
+ $store_profile="silent";
local $_;
store "=spam" .";$_","log" if $_=dnsbl '.relays.ordb.org.' ,1; # all hosts
store "=spam" .";$_","log" if $_=dnsbl '.blackholes.mail-abuse.org.' ,1; # all hosts
# I don't send viruses but viruses propagate mails of mine
store "=spam" if headeris "X-Mailer",'ravmd/8.3.2';
};
+ $store_profile=undef();
# special delivery
store "=err","bell" and return if headerhas \&Received_for,'<short+err@>';
# nasty public lists with $store_ignore
{
- local $store_profile="log";
+ # Do not local $store_file as it is our-imported
+ $store_profile="log";
local $store_ignore;
$store_ignore="smsmail" if 1==$Audit->body() && length(join "",$Audit->body())<180; # SMS mail
$store_ignore="sms OS" if $Audit->subject()=~/^Email pro: /; # "^Email pro: gsm@sh\.cvut\.cz$";
store "=9kc","log" if headeris "List-Post",'<n9k@pandora.cz>';
store "=9kcd","log" if headeris "List-Post",'<dev9k@pandora.cz>';
}
+ $store_profile=undef();
# lists
store "=mozillabug","log" if headeris "From" ,'<bugzilla-daemon@mozilla.org>';