Re: [exim] struggling with conditions

Pàgina inicial
Delete this message
Reply to this message
Autor: Magnus Holmgren
Data:  
A: exim-users
Assumpte: Re: [exim] struggling with conditions
On Wednesday 09 May 2007 05:47, Dominique wrote:
> I have made a revised, simplified version based on your previous post.
>
> My ACL now looks like this:
>
>   defer
>         warn set acl_m_PROTECTION = ${lookup mysql{SELECT protection FROM
> domain_settings WHERE domain_
> name='$domain'}}


You can't nest ACL statements. What you have there is a defer without
conditions, which either is a syntax error or means that you will always
defer. Have you read chapter 40 *carefully*?

>         !senders = : postmaster
>         #defer condition = {if eq{acl_m_PROTECTION}{2} }
>         #       !local_parts = +skip_grey
>         #       acl = greylist_acl
>         #{ !local_parts = +skip_grey}}
>         #       acl = greylist_acl
>         #       !local_parts =
>         #       acl = greylist_acl
>         #defer condition = {if eq{acl_m_PROTECTION}{3}}{yes}{no}
>         #       local_parts = +partial_grey
>         #       acl = greylist_acl
>         #accept condition = {if eq{acl_m_PROTECTION}{2}}{yes}{no}
>         #       !local_parts = +skip_grey
>         #       acl = greylist_acl
>         #defer condition = {if eq{acl_m_PROTECTION}{1}}{yes}{no}
>                 acl = greylist_acl

>
>                 message = Greylisted

>
>
> But this is not really going to work either. Essentially what I'm looking
> for are if statements.
>
> something like the meta code below:
>
> if acl_m_PROTECTION == 2:
>     # do not protect these local parts
>     !local_parts = +skip_grey
>     acl = greylist_acl
> elsif acl_m_PROTECTION == 3:
>     # protect only these local parts
>     local_parts = +partial_grey
>     acl = greylist_acl

>
> Is something like this doable in ACLs?


Yes, with multiple ACL statements like the suggestion I gave you. To avoid
repetition you use sub-ACLs, just like you have done. If you want
greylist_acl to return accept for "greylisted" and deny for "whitelisted",
then change the accepts into defers in my suggested solution.

-- 
Magnus Holmgren        holmgren@???
                       (No Cc of list mail needed, thanks)


"Exim is better at being younger, whereas sendmail is better for
Scrabble (50 point bonus for clearing your rack)" -- Dave Evans