[Mimedefang] Unsafe file types
    Lucas Albers 
    admin at cs.montana.edu
       
    Sun Nov 30 18:45:04 EST 2003
    
    
  
how about this?
This used the perl library for mimetype determination.
install File::MimeInfo::Magic
Then install binary package for your os.
http://freedesktop.org/Software/shared-mime-info
This should be a more generalized solution, as you can just add in the
types to block on the regular expression match after the comparison.
 use File::MimeInfo::Magic;
   sub filter ($$$$) {
     my($entity, $fname, $ext, $type) = @_;
     my $path = $entity->bodyhandle->path;
     my $mimeftype = mimetype($path);
     if ($mimeftype =~ /^application\/x-executable$/) {
     return action_bounce("$fname smells like a Windoze EXE...");
    }
}
--Luke
    
    
More information about the MIMEDefang
mailing list