[Mimedefang] That .com extension

Steffen Kaiser skmimedefang at smail.inf.fh-bonn-rhein-sieg.de
Wed Jan 4 03:17:25 EST 2006


On Tue, 3 Jan 2006, Joseph Brennan wrote:

>
> An attachment with this name was snagged as an executable by the
> example filter_bad_filename routine:
>
> WSJ.com - Cutting Hedge_ Law Firm Grows With Funds.pdf
>
> It must be because of the ".com " in the name.

I just took a look at man mimedefang-filter, you could try this:

       action_defang($entity, $name, $fname, $type)
               Accept  the part, but change its name to $name, its
               suggested filename to $fname and its MIME  type  to
               $type.   If  $name  or  $fname are "", then mimede­
               fang.pl generates generic names.  Do not  use  this
               action in filter_multipart.

e.g. when you call filter_bad_filename() and it triggers a bad file, you 
could try to peek into the filename and rename it into, say,

$filename =~ s/[\s\r\n\;\[\]\(\)\=\+\:_]+/_/gs;

Maybe this is a good thing to do for all attachements, however, 
action_defang() will append a "warning" noting the change.

Bye,

-- 
Steffen Kaiser


More information about the MIMEDefang mailing list