filtering file types vs. extensions -- New 4.22-3

Julian Field mailscanner at
Mon Jun 23 15:13:23 IST 2003

At 14:43 23/06/2003, you wrote:

>On Montag, Juni 23, 2003, at 03:34  Uhr, Scott Adkins wrote:
>>As opposed to running the "file" command everytime, why not suck in the
>>/etc/magic file and use it?  That is all the file command really does...
>>You can even provide your own version of the /etc/magic file (and allow
>>a config option to be changed to use a different one if need be) so that
>>you can support it on systems (like Windows) that don't have a /etc/magic
>>file on hand, or has the file, but is rather weak.
>Would this be an option as well:

Unfortunately that module is rather old and doesn't support current Linux
magic files, so it's no use. Reading in the magic file is not really
possible either as different systems use very different formats in the
magic file, and it would involve re-writing the GNU file command (which is
about the best of the lot) in perl, which counts as re-inventing the wheel
in my book. You may have noticed I don't tend to do that :-)

So, sticking with the good old "file" command that is usually in
/usr/bin/file (though you can configure the location and add command-line
switches if necessary), I have written an implementation for you. Currently
it isn't quite perfect as it relies on you being able to have very long
commands for large batches of messages with lots of attachments. I will
re-write this bit to put a limited number of attachments in each "file"
command before it goes in the stable distribution.

What I would really like is suggestions of what should go in the
filetype.rules.conf file. Currently it is minimal (to put it mildly). By
default it allows files that don't match any rule, just like the
filename.rules.conf file.
What other rules should I add to it?
Julian Field
MailScanner thanks transtec Computers for their support

More information about the MailScanner mailing list