[Mimedefang] Custom Filter Bad Filename
schmaus
schmaus at ties2.net
Wed Apr 2 13:54:01 EST 2003
I tweaked the filter_bad_filename subroutine so it would set
the $bad_exts based on the domain of the recipient. It does
not seem to work and I have looked at it for 2 days.
Can anybody shed some light as to why it does not work?
It does not create any errors in my logs but when I try a
test attachment, it never gets pulled out of the email.
Benjamin
Code-----------------------------------------------
sub filter_bad_filename ($) {
my($entity) = @_;
my($bad_exts, $re);
my($junk,$tdomain);
my($EXTDB,$new_exts);
$tdomain = "UNKNOWN";
open (HDRS,"./COMMANDS");
while (<HDRS>) {
if ($_ =~ /^R\</) {
chomp;
($junk,$tdomain) = split(/\@/);
$tdomain =~ s/\>//g;
}
}
close (HDRS);
$dbh = DBI->connect($dsn,$dbu,$dbp) or die "Access
Failed";
$sth = $dbh->prepare("select extension from
extensions where customer = '$tdomain'");
$sth->execute();
while (($EXTDB)=$sth->fetchrow_array()) {
$new_exts .= $EXTDB . "|";
}
$sth->finish();
$dbh->disconnect;
if ($new_exts eq "") {
$new_exts="zzz";
}
chop ($new_exts);
$bad_exts = "\'($new_exts)\'";
$re = '(\{)|(\})|(\.' . $bad_exts .
')\.*([^-A-Za-z0-9_.]|$)';
return re_match($entity, $re);
}
More information about the MIMEDefang
mailing list