Deny File MIME Types not working

Julian Field MailScanner at ecs.soton.ac.uk
Mon Jul 5 16:17:22 IST 2010


Bug. Well found.

Try applying this patch to 
/usr/lib/MailScanner/MailScanner/SweepOther.pm. Take off the start and 
end line I have added.

Please let me know if this fixes it for you.

Jules.

--- PATCH START ---
--- SweepOther.pm    2010-04-22 17:12:43.000000000 +0100
+++ SweepOther.pm.new    2010-07-05 16:13:32.000000000 +0100
@@ -471,7 +471,9 @@

    # If we are not using "file -i" at all, then just short-circuit all
    # of this, and check file command output only.
-  unless ($MailScanner::Config::UsingFileICommand) {
+  unless ($MailScanner::Config::UsingFileICommand ||
+           MailScanner::Config::Value('denyfilemimetypes') ||
+           MailScanner::Config::Value('adenyfilemimetypes')) {
      $Counter = CheckFileTypesRules($batch, \%FileTypes, undef);
      return $Counter;
    }
--- PATCH END ---

On 04/07/2010 12:18, Terence Chan wrote:
>
> Hi,
>
>
> I need to selectively allow certain people to send image files, and I 
> have ran into problems.
>
>
> I have the following configuration.
>
>
> Deny File MIME Types = %rules-dir%/deny.filemimetypes.rules
>
>
> in the %rules-dir%/deny.filemimetypes.rules file
>
>
> From: terence at vicosys.com.hk <mailto:terence at vicosys.com.hk> image/png
>
>
> When I try to send a email attached a png file - the mail can still 
> pass thru. I tested the file using file -i command, the mime type is 
> "image/png"
>
>
> I traced the code and found out that the coding for "file -i" has not 
> been used. ($MailScanner::Config::UsingFileICommand = 0), so it has 
> never tried to look at the MIME type.
>
>
> if I hack the Config.pm and 
> force $MailScanner::Config::UsingFileICommand = 1, it all works.
>
>
> Is this a bug or if it is some misconfiguration on my part?
>
>
> Thanks
>
>

Jules

-- 
Julian Field MEng CITP CEng
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store

Need help customising MailScanner?
Contact me!
Need help fixing or optimising your systems?
Contact me!
Need help getting you started solving new requirements from your boss?
Contact me!

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
Follow me at twitter.com/JulesFM and twitter.com/MailScanner


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MailScanner mailing list