[Mimedefang] Re: Only Scan certain sized attachments for viruses
Jason Englander
jason at englanders.cc
Fri Sep 12 14:24:02 EDT 2003
On Fri, 12 Sep 2003, schmaus wrote:
> Does anyone have a snippet of code for scanning only certain
> sized email attachments? In other words if attachment is
> less that 10mb scan it?
my $size = (stat($entity->bodyhandle->path))[7];
if ($size < 10000000) {
# scan it
}
(note: that's 10 MB, not 10,000k or 10 MiB <g>)
This should be in filter and the "scan it" part should call
entity_contains_virus.
If you use something like the default filter, keep in mind that you
already scanned the whole message in filter_begin. If you're trying to
avoid that too, then you'd have to put something in filter_begin to see
if any of the files in the work directory are too big, then decide to
call message_contains_virus or not based on that.
Jason
--
Jason Englander <jason at englanders.cc>
394F 7E02 C105 7268 777A 3F5A 0AC0 C618 0675 80CA
More information about the MIMEDefang
mailing list