#!/usr/local/bin/perl -U $time = time; $nowtime = localtime($time); if ($ENV{'TCPREMOTEIP'} ne "") { open(FILE,"/etc/tcp/tcp.smtp.filter.iplist"); while() { chop; if ($_ eq $ENV{'TCPREMOTEIP'}) { close(FILE); exit; } } close(FILE); open(FILE,">>/etc/tcp/tcp.smtp.filter.newer"); print FILE "$ENV{'TCPREMOTEIP'}:allow,RELAYCLIENT=//\n"; close(FILE); open(FILE,">>/etc/tcp/tcp.smtp.filter.iplist"); print FILE "$ENV{'TCPREMOTEIP'}\n"; close(FILE); open(LOG,">>/etc/tcp/tcp.smtp.filter.log"); print LOG "$nowtime from $ENV{'TCPREMOTEIP'}\n"; close(LOG); open(LOG,">>/etc/tcp/tcp.smtp.filter.log"); print FILE "$ENV{'TCPREMOTEIP'}\n"; close(FILE); open(LOG,">>/etc/tcp/tcp.smtp.filter.log"); print LOG "$nowtime from $ENV{'TCPREMOTEIP'}\n"; close(LOG); exec("/bin/cat /etc/tcp/tcp.smtp /etc/tcp/tcp.smtp.filter.newer /etc/tcp/tcp.smtp.filter.older | /usr/local/bin/tcprules /etc/tcp/tcp.smtp.cdb /etc/tcp/tcp.smtp.cdb.$$"); } else { open(LOG,">>/var/log/tcp.smtp.filter.log"); print LOG "$nowtime from unknown.\n"; close(LOG); }