--- a/Makefile Fri Aug 05 15:29:52 2005 +0000
+++ b/Makefile Fri Aug 05 21:19:04 2005 +0000
@@ -10,21 +10,27 @@
prefix = $(stowdir)/$(p)
bindir = $(prefix)/bin
-.PHONY: all install uninstall
+.PHONY: all install clean uninstall
-all:
- @echo "Nothing. Just install :)"
+all: .ok.$(BIN)
+ @test -x $(BIN) || chmod +x $(BIN)
install: $(BIN)
install -d $(bindir)
install -m 0755 $(BIN) $(bindir)/
stow -d $(stowdir) -vR $(p)
+clean:
+ @-rm -fv .ok.*
+
uninstall:
stow -d $(stowdir) -vD $(p)
rm -rf $(stowdir)/$(p)
+.ok.%: %
+ @perl -c $<
+ @touch $@
# vim:sts=4 sw=4 aw ai sm:
--- a/exiacl Fri Aug 05 15:29:52 2005 +0000
+++ b/exiacl Fri Aug 05 21:19:04 2005 +0000
@@ -8,16 +8,16 @@
--[no]log show the log output [!$Cf->log!]
--[no]debug show debug debug output [!$Cf->debug!]
+ --from=s from: [!$Cf->from!]
+ --to=s to: [!$Cf->to!]
+
+ --Helo=s HELO [!$Cf->Helo!]
+ --From=s MAIL FROM: [!$Cf->From!]
+ --To=s RCPT TO: [!$Cf->To!]
+
--src=s src ip/name [!$Cf->src!]
--dst=s dst ip/name [!$Cf->dst!]
-
- --Helo=s helo name [!$Cf->Helo!]
- --From=s envelope from [!$Cf->From!]
-
- --from=s mail from: [!$Cf->from!]
- --to=s rcpt to: [!$Cf->to!]
-
--exim=s exim binary [!$Cf->exim!]
--config=s exim config file [!$Cf->config!]
@@ -34,23 +34,30 @@
use Socket;
use File::Basename;
+
+sub exim_option($);
+sub read_exim($);
+sub write_exim($@);
+sub addr(@);
+sub hostname() { chomp (my $h = `hostname -f`); return $h; }
+
use constant ME => basename $0;
-
+use constant HOSTNAME => hostname;
use constant CONFIG => (
{ CASE => 1 },
log => { ARGS => "!", DEFAULT => 1 },
debug => { ARGS => "!", DEFAULT => 0 },
- src => { ARGS => "=s" }, # hostname -f
- dst => { ARGS => "=s" }, # primary_hostname
-
- Helo => { ARGS => "=s", ALIAS => "Ehlo" }, # hostname -f
+ from => { ARGS => "=s" },
+ to => { ARGS => "=s" },
- From => { ARGS => "=s", DEFAULT => "<>" },
- from => { ARGS => "=s", DEFAULT => "postmaster\@exim.org" },
+ Helo => { ARGS => "=s", ALIAS => "ehlo" },
+ From => { ARGS => "=s" },
+ To => { ARGS => "=s" },
- to => { ARGS => "=s", DEFAULT => "hans\@nowhere.example" },
+ src => { ARGS => "=s", DEFAULT => "172.20.1.8" },
+ dst => { ARGS => "=s" }, # exim primary_hostname
exim => { ARGS => "=s", DEFAULT => $ENV{EXIM} || "exim" },
config => { ARGS => "=s", DEFAULT => $ENV{EXIM_CONF} || "/etc/exim/exim.conf.t" ,
@@ -60,22 +67,26 @@
);
-sub exim_option($);
-sub read_exim($);
-sub write_exim($@);
-sub addr(@);
-sub hostname() { chomp (my $h = `hostname -f`); return $h; }
-
-use constant HOSTNAME => hostname;
my $Cf;
$Cf = new AppConfig CONFIG or die;
$Cf->dst(addr(exim_option("primary_hostname")));
- $Cf->getopt(\@ARGV) or die $@;
- $Cf->From($Cf->from) unless $Cf->From;
- $Cf->src(addr(HOSTNAME)) unless $Cf->src;
- $Cf->Helo(HOSTNAME) unless $Cf->Helo;
+ $Cf->getopt(qw(pass_through no_ignore_case)) or die $@;
+
+ $Cf->From($Cf->from) unless $Cf->From;
+ $Cf->To($Cf->to) unless $Cf->To;
+
+ $Cf->Helo((split/@/, $Cf->from||"")[1] || HOSTNAME)
+ unless $Cf->Helo;
+ $Cf->dst(addr(HOSTNAME)) unless $Cf->dst;
+
+ $@ = "";
+ foreach (qw/from to src dst/) {
+ $Cf->get($_) or $@ = join " ", $@, $_;
+ }
+
+ die ME.": Missing values: $@\n" if $@;
MAIN: {
@@ -84,7 +95,7 @@
my ($w, $r);
my @cmd = ($Cf->exim,
-C => $Cf->config,
- $Cf->dst ? (-oMi => addr($Cf->dst)) : (),
+ -oMi => addr($Cf->dst),
-bhc => addr($Cf->src),
@ARGV); # remaining args are exim native