[Mimedefang] action_replace_with_url
bart
bartoszx at euro26.pl
Fri Mar 4 05:38:30 EST 2005
Hi
This is what I got in my mimedefang-filter
I set $size > 100 for testing
No errors no link
What do I have to add to make it work
sub filter ($$$$) {
my($entity, $fname, $ext, $type) = @_;
return if message_rejected(); # Avoid unnecessary work
# Block message/partial parts
if (lc($type) eq "message/partial") {
md_graphdefang_log('message/partial');
action_bounce("MIME type message/partial not accepted here");
return action_discard();
}
if (filter_bad_filename($entity)) {
md_graphdefang_log('bad_filename', $fname, $type);
return action_drop_with_warning("An attachment named $fname was removed from this document as it\nconstituted a security hazard. If you require this document, please contact\nthe sender a
}
# eml is bad if it's not multipart
if (re_match($entity, '\.eml')) {
md_graphdefang_log('non_multipart');
return action_drop_with_warning("A non-multipart attachment named $fname was removed from this document as it\nconstituted a security hazard. If you require this document, please contact\
}
# 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 > 1000) {
return action_replace_with_url($entity,
"/home/www",
"http://www.example.com/",
"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();
}
More information about the MIMEDefang
mailing list