Re: [exim] Mime + filename matching

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Phil Pennock
Ημερομηνία:  
Προς: Craig Jackson
Υ/ο: exim-users
Αντικείμενο: Re: [exim] Mime + filename matching
On 2008-02-08 at 10:10 -0600, Craig Jackson wrote:
>         condition = ${if or { \
>                 {
> match{${lc:$mime_filename}}{\N^(?>.*)(?<=zip|emz|iso|wma|jpg|jpeg|pps|pp
> t|gif|png|wmv|mpg|mp3|mpeg|avi|wav|bmp|mov|asf|asx|mpe)\N}} \
>                 {
> match{${lc:$mime_content_type}}{\N^(zip|emz|iso|wma|jpg|jpeg|pps|ppt|gif
> |png|wmv|mpg|mp3|mpeg|avi|wav|bmp|mov|asf|asx|mpe)\N}} \
>                 }{1}{0}}
>         set acl_m7 = 1

>
> This acl works perfectly except for certain emails and I'm not smart
> enough to figure out how to get Exim to work to work with those emails.


> --____RAAJBJVHFFDKGUUJDDWU____
> Content-ID: <LTPCYOQCHLLK.GW}00014.BMP>
> Content-Type: image/BMP
> Content-Transfer-Encoding: base64
>
> Seems to me that the acl should have seen that MIME boundary and set
> acl_m7 to 1. Can someone please tell me why it didn't?


The match condition does a regexp comparison; unlike 'regexp as an item
in a list' it doesn't default to case-insensitive.

$ exim -be
> ${if match{foo}{\N^f[aeiou].$\N} {w00t}{bah}}

w00t
> ${if match{FOO}{\N^f[aeiou].$\N} {w00t}{bah}}

bah
> ${if match{foo}{\N(?i)^f[aeiou].$\N} {w00t}{bah}}

w00t
> ${if match{FOO}{\N(?i)^f[aeiou].$\N} {w00t}{bah}}

w00t
>


By putting "(?i)" in the regexp before the literal characters, you make
sure that they're interpreted in a case-insensitive manner.

"man pcrepattern" and "INTERNAL OPTION SETTING".

-Phil