Move My-Audit to PerlMail::Config.
[PerlMail.git] / perlmail-accept
index d0909da..30e7833 100755 (executable)
@@ -27,7 +27,11 @@ INIT {
        }
 
 
-use PerlMail::Config;
+use File::Basename;
+BEGIN {
+       use lib $ENV{"PERLMAIL_BASEDIR"} || File::Basename::dirname($0);
+       use PerlMail::Config;
+       }
 
 use Mail::Audit qw(MAPS);
 require IO::Handle;
@@ -35,7 +39,6 @@ use Carp qw(cluck confess);
 use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG);
 require POSIX; # for ceil
 use User::Utmp;
-require File::Basename;
 use Getopt::Long;
 require Mail::Address;
 require MIME::Words;
@@ -728,7 +731,6 @@ my($header,$map)=@_;
 
 # MAIN
 
-my $basedir=File::Basename::dirname($0);
 $Getopt::Long::ignorecase=0;
 die "GetOptions error" if !Getopt::Long::GetOptions(
                  "inetd"    ,sub { $opt_mode=\&inetd; },
@@ -738,21 +740,13 @@ die "GetOptions error" if !Getopt::Long::GetOptions(
                  "idle!"    ,\$opt_idle,
                  "idletest" ,sub { syslogging_restore(); print((defined($_=useridle()) ? $_ : "<undef>")."\n"); exit 0; },
                  "muttrc"   ,sub { syslogging_restore(); print scalar muttrc(); exit 0; },
-               "d|basedir=s",\&basedir,
                );
 # "Excessive arguments" checked in &inetd
 die "Missing mode" if !$opt_mode;
 
-my $filenameMyAudit="$basedir/My-Audit.pm";
-open AUDIT,$filenameMyAudit or die "open \"$filenameMyAudit\": $!";
-{
-       local $/=undef();
-       eval <AUDIT> or die "eval \"$filenameMyAudit\": $@";
-       audit_init();
-       %alternates_host=map((lc($_)=>1),@alternates_host);
-       %dnsbl_whitelist=map((   $_ =>1),@dnsbl_whitelist);
-       }
-close AUDIT or warn "close \"$filenameMyAudit\": $!";
+PerlMail::Config::audit_init();
+%alternates_host=map((lc($_)=>1),@alternates_host);
+%dnsbl_whitelist=map((   $_ =>1),@dnsbl_whitelist);
 
 &$opt_mode();
 die "NOTREACHED";