Re: [exim] Help to logical OR two conditions

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Jeremy Harris
Data:  
Para: exim-users
Assunto: Re: [exim] Help to logical OR two conditions
On 01/10/2020 12:45, Victor Sudakov via Exim-users wrote:
> accept condition = ${lookup{$local_part@$domain}lsearch{/etc/dovecot/aliases}{yes}}
>
> Doesn't this line mean that the right part of the expression is err... hmm... a condition?


No. The ACL general-purpose condition called "condition" takes a string
argument and converts it, using *its* set of rules, into a conditional
value for the ACL.

But you are dealing with an expansion condition, a different thing,
which is not a string. It is a separate concept. You were trying
to use a string (derived from an expansion, a lookup - but that isn't
really important here).
You could convert that string into an expansion condition, by using
either "bool" or "eq". Bool would be simpler.

> OK, I have changed my expression to

[...]
> Then into
>
>  accept condition =  ${if or {\
>                       {eq{${lookup{$local_part@$domain}lsearch{/etc/dovecot/aliases}{yes}}{yes}}} \
>                       {eq{${lookup{$local_part@$domain}lsearch{/etc/dovecot/users}{yes}}{yes}}} \
>                       } {yes}}

>
> and still:
>
> failed to expand ACL string "${if or {{eq{${lookup{$local_part@$domain}lsearch{/etc/dovecot/aliases}{yes}}{yes}}} {eq{${lookup{$local_part@$domain}lsearch{/etc/dovecot/users}{yes}}{yes}}} } {yes}}": missing 2nd string in {} after "eq" inside "or{...}" condition


re-laying out that...

${if or {\
         {eq \
            {${lookup{$local_part@$domain}lsearch{/etc/dovecot/aliases}{yes}} \
                                                                          ^^^^  missing a } here
            {yes}\
         } \
        } \


                      {eq{${lookup{$local_part@$domain}lsearch{/etc/dovecot/users}{yes}}{yes}}} \
                     } {yes}}


>
> Can you possibly please reword my combined expression into a working one?


I like to use a bracket-matching-capable editor when developing
complex conditions.
--
Cheers,
Jeremy