filtering file types vs. extensions

Scott Adkins adkinss at OHIO.EDU
Mon Jun 23 14:34:36 IST 2003

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.

Anyways, saving on fork/execs at a cost of a little bit of persistant
memory should be quite worth it...


--On Monday, June 23, 2003 10:26 AM +0100 Julian Field 
<mailscanner at ECS.SOTON.AC.UK> wrote:

> At 23:21 22/06/2003, you wrote:
>> On Fri, 2003-06-06 at 14:16, Julian Field wrote:
>> > Not a good start.
>> > The latest File::MMagic module does not understand Linux
>> > /usr/share/magic files. It complains a lot about them, which makes it
>> > useless. So I will have to use the "file" command, with a timeout and
>> > all that c**p to stop DoS attacks on the file command.
>> >
>> > Does everyone's "file" command output the filename followed by a ":"
>> > followed by 1 or more spaces followed by the file type?
>> Just wondered how this ended up going.  Did it prove more trouble than
>> it's worth?
> I haven't done much more on this. I need to play around with the file
> command on a bunch of different OS's to see if the output format is
> vaguely consistent. If so, then it is possible and I'll take another look
> at this. Bear in mind that it will take noticeable CPU to do it, as it
> involves a "file" command for each batch of messages. Cheap compared to
> spam detection though.
> --
> Julian Field
> Professional Support Services at
> MailScanner thanks transtec Computers for their support

      Scott W. Adkins      
   UNIX Systems Engineer                  mailto:adkinss at
        ICQ 7626282                 Work (740)593-9478 Fax (740)593-1944
     PGP Public Key available at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 231 bytes
Desc: not available
Url :

More information about the MailScanner mailing list