[Mimedefang] Running A/V & A/Spam for Local-host-names only
Kevin A. McGrail
kmcgrail at pccc.com
Fri Oct 10 18:32:12 EDT 2003
Chris,
Basically it sounds like no one has an easy solution for anything short of
reading the local_host_names table and parsing for domains matches on the
recipients. Your pseudo is close to what I had in my head but I don't think
stream_by_domain() can be used anywhere but in filter_begin.
So I think this will work and I'll try and implement after I run it by the
mailing list:
sub filter_begin {
if (stream_by_domain()) {
return;
}
etc....
}
sub look_up_local_Cw {
my (%local_host_names);
$local_host_names{'cached'} = 1;
open the file /etc/mail/local_host_names (use IO::File? probably not)
for each hostname {
$local_host_names{hostname} = 1;
}
close file;
return (\%local_host_names);
}
sub filter {
my($entity, $fname, $ext, $type) = @_;
my ($local_host_names_hash) = &look_up_local_Cw;
if ($local_host_names_hash->{$Domain} > 0) {
#Do filtering
} else {
#Don't Filter
}
}
Regards,
KAM
> Am I missing something, or is perhaps stream_by_domain() the solution
here?
>
> Something that almost looks like Perl...
>
> sub filter_end() {
> if ( stream_by_domain() ) {
> return;
> }
> @LocalDomains = read_localhostnames_table();
> for $dom ( @LocalDomains ) {
> # All recipients are in the same domain, so we only need to
> # compare the first one...
> if ( $Recipients[0] =~ /@$dom$/ ) {
> # do local-domain neat stuff here
> last;
> }
> }
> # Do the stuff that everyone needs
> }
>
> Chris Myers
> Networks By Design
More information about the MIMEDefang
mailing list