Re: MIME Encapsulation Depth ?

Jerry Nicholls <[email protected]> Mon, 11 Apr 2005 14:15:20 +0100
Newsgroups gmane.mail.exim.exiscan.user
Message-ID <1113225320.14763.19.camel@plasma>
On Mon, 2005-04-11 at 14:01 +0200, Tom Kistner wrote:
> Jerry Nicholls wrote:
> 
> > Is it possible with Exiscan to know how deeply nested an rfc-2822
> > attachment (or any other MIME container) is within the ACL
> > acl_smtp_mime ?
> 
> You can count using an ACL variable, like this (untested).
> 
> warn log_message = Current RFC822 attachment depth: $acl_m0
>       condition = $mime_is_rfc822
>       condition = ${if eq{$mime_part_count}{0}{1}{0}}
>       set acl_m0 = ${eval:$acl_m0+1}
> 
> deny message = Suspected attachment loop.
>       condition = ${if >{$acl_m0}{10}{1}{0}}

I'm not entirely sure that this would work, I've come up with similar
ideas prior to contacting the list.

I'm trying to make my test as generic as possible, but for the purposes
of the specific problem of attachment loops, I'll only refer to rfc822
attachments.

Using a counter of some form appears to be the best way to go, but would
need some form of 'reset' to allow for multiple rfc822 attachments in
the same email, ie at the same encapsulation depth (asci art follows) :

[[text] [rfc822                 #1] [rfc822 #2]]
        [[text] [rfc822        #3]] [text     ]]
                [[text][rfc822 #4]
                       [text     ]            

Also, how does the MIME acl traverse the container tree ? Is it depth
first search or not ? If it's depth first then your acl fragment will
end up with the bottom container being at depth '1'.

Having had more of a think whilst doing the above 'art', I think that
I'd have to be more generic that rfc822 attachments since it these error
bounces are more likely to be plain nested mime containers.

Any possibility of a $mime_encapsulation_depth variable ? One that
simple gives a count of the number of enclosing containers.

Thanks,
Jerry.
-- 
Jerry Nicholls                       E: [email protected]
Core & Network Operations Manager    W:            http://www.zen.co.uk/
Zen Internet Ltd.                    T:                    0845 058 9000
                                     F:                    0845 058 9005