[Mimedefang] (newbie) attachment authentication
David F. Skoll
dfs at roaringpenguin.com
Mon Feb 25 10:12:38 EST 2002
On Mon, 25 Feb 2002, josh wrote:
> I want to make sure that an attachment is really what it claims
> to be i.e. a .doc file is really a .doc and not an .exe.
That's probably impossible in general, but for many cases, it will work.
> Do I need to
> run the unix command "file" to do this
Yes, or some equivalent like opening $entity->bodyhandle->path yourself
and examining the file contents. But it's best to do something like this:
$path = $entity->bodyhandle->path;
$UnixFileSays = `file $path`;
# Now use $UnixFileSays...
Be aware that these tests are likely to be expensive, because they fork() and
exec() for each attachment.
Regards,
David.
More information about the MIMEDefang
mailing list