[Mimedefang] Replace Large Attachments with URL's
Kurt Kesler
atwork at keslers.net
Wed Jul 3 13:03:30 EDT 2002
Well, I added it into the filter section and restarted. Testing showed
no errors but it still does not appear to function. Here is the
relevant section:
Thanks,
Kurt
#***********************************************************************
sub filter {
my($entity, $fname, $ext, $type) = @_;
if (filter_bad_filename($entity)) {
return action_quarantine($entity, "An attachment named $fname
was removed from this document as
it\nconstituted a security hazard. If you require this document, please
contact\nthe sender and arrange an
alternate means of receiving it.\n");
}
# eml is bad if it's not multipart
if (re_match($entity, '\.eml')) {
return action_quarantine($entity, "A non-multipart attachment
named $fname was removed from this
document as it\nconstituted a security hazard. If you require this
document, please contact\nthe sender
and arrange an alternate means of receiving it.\n");
}
# Clean up HTML if Anomy::HTMLCleaner is installed.
if ($Features{"HTMLCleaner"}) {
if ($type eq "text/html") {
return anomy_clean_html($entity);
}
#Added section for dealing with large attachments
#**********************************************************************
$size = (stat($entity->bodyhandle->path))[7];
if ($size > 1000000) {
return action_replace_with_url($entity,
"/usr/local/www/data/mail_parts",
"http://www.keslers.net/mail_parts",
"The attachment $fname was larger than 10,000,000 bytes.\n" .
"It was removed, but may be accessed at this URL:\n\n" .
"\t_URL_\n");
}
}
return action_accept();
}
"David F. Skoll" wrote:
>
> On Wed, 3 Jul 2002, Kurt Kesler wrote:
>
> > Here it is.
>
> Hi, Kurt.
>
> The problem is that you added your code outside any Perl subroutine. The
> code must appear inside the "filter" sub.
>
> Regards,
>
> David.
>
> _______________________________________________
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
More information about the MIMEDefang
mailing list