Re: [exim] Help to logical OR two conditions

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Victor Sudakov
Data:  
Para: exim-users
Assunto: Re: [exim] Help to logical OR two conditions
Evgeniy Berdnikov via Exim-users wrote:
> On Thu, Oct 01, 2020 at 05:21:38PM +0700, Victor Sudakov via Exim-users wrote:
> > Jeremy Harris via Exim-users wrote:
> > > On 01/10/2020 10:00, Victor Sudakov via Exim-users wrote:
> > > > And I'm damned if I understand what is "condition name expected."
> > >
> > > http://exim.org/exim-html-current/doc/html/spec_html/ch-string_expansions.html
> > >
> > > Section 7, "Expansion conditions".
> >
> > I've read it, and "8. Combining expansion conditions" too.
> >
> > But some help with combining the specific conditions I have provided would
> > be much more appreciated.
>
> You feed the string "yes" to or{..} as argument, but Exim does not treat
> strings as conditions.


I'm afraid I don't understand you. Look at this quite legitimate line:

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?

> In particular, bool{} transforms string to boolean,
> you can do conversion with it. Or use syntax like eq{{LOOKUP}{yes}}.


OK, I have changed my expression to

  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 it's not the thing:

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}}": each subcondition inside an "or{...}" condition must be in its own {}

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

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

>
> > Obviously if a person has read the manual and is struggling with syntax,
> > sending the person back to the manual is not quite helpful, especially if
> > you know the answer.
>
> IMHO, Exim documentation is very clean and structured.


I agree. Exim is my favorite opensource MTA.

> However, it assumes some background in CS and/or programming.


Even people with some background in CS and/or programming often need
and appreciate good cookbooks and howtos.

BTW while googling for the solution, I've found quite a few questions in mailing
lists and Web-fora where people are frustrated by exim's nested conditions.

--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/