On Mon 31/Dec/2012 17:38:06 +0100 Michael Heydekamp wrote:
From a practical side of view, the still open question for us is: How to (re)build a fixed magic.mgc which does at least support "Return-Path:", "Return-path:" and "return-path:"?
libmagic provides for case insensitive comparisons. For file-5.12, the latest version, there are "c" and "C" switches that make the comparison fully case insensitive. For file-5.04, the version on debian squeeze, only "c" seems to be provided, hence it would be necessary to rewrite the magic test string in all-lowercase.
BTW, that spurious text/x-mail mime type has been removed from the source in file-5.10. The resulting behavior is equivalent to using MAGIC_NO_CHECK_TOKENS. PHP doesn't define such constant, but it is defined as 0x100000 in src/magic.h. What happens if you run, say,
php -r '$f=new finfo(FILEINFO_MIME|0x100000); print $f->file("YOUR.eml")."\n";'
(Although I have file-5.04 too, on debian squeeze, I'm unable to get text/x-mail: I get text/plain for "Return-path:".)
Plus that finfo is apparently also able to load a plain text file instead of a compiled magic.mgc, but it doesn't load every magic text file that I can find on our server. I will have to dig a little deeper into that issue, unless somebody else can help with more specific information.
What PHP version does roundcube require? According to the Notes at http://php.net/manual/en/function.finfo-open.php , PHP >= 5.3.11 and
= 5.4.1 upgraded to libmagic 5. However, slight changes in the
format of the magic file are possible even between minor versions.