X-Git-Url: http://git.jankratochvil.net/?p=PerlMail.git;a=blobdiff_plain;f=perlmail-accept;h=30e7833254fcf66aef09b191937c0445db69a28a;hp=d0909da2f1a5764cd9565fb9a3061fe45d7717fb;hb=9d03569bd26dfb0f54f21063445fc9d28ed1c4d3;hpb=c23c7da69d6fabcd20481ca42cfe551626bfbcc5 diff --git a/perlmail-accept b/perlmail-accept index d0909da..30e7833 100755 --- a/perlmail-accept +++ b/perlmail-accept @@ -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()) ? $_ : "")."\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 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";