RE: [Exim] Boolean evaluation

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Bernard Stern
Date:  
À: exim-users
Sujet: RE: [Exim] Boolean evaluation
On Mon, 19 Feb 2001 11:51:23 +0200 "Dmitry Shikut" wrote:

>> >     When 'subcond1 = FALSE', 'subcond2' do not participate in 'and'
>> > condition...
>> Exim does.
>     That's great...


>> >     How can I resolve this problem?

>>
>> I already posted the solution. You are missing a "}" at a crucial point
>> in your string.
>     I'm received this solution... There is no '}' in my example... That's
> right...


>     But look at this example:


> ${if
> and{{exists{/usr/local/etc/exim/domains/virus22.com/passwd}}{eq{qwerty}{${ex
> tract{1}{:}{${lookup{shikut}lsearch{/usr/local/etc/exim/domains/virus22.com/
> passwd}{$value}{fail}}}}}}}{yes}{no}}


First I don't think you want {fail}, but merely fail. {fail} would in
fact return the string 'fail', which, if I'm interpreting your stuff
correctly, is not what you want.

The condition is 'file foo must exist AND string bar must match looked up string'.
You can rewrite your condition without the AND.

condition = ${if condition {true-replacement} fail}

with

condition = exists {/usr/local/etc/exim/domains/virus22.com/passwd}
true-replacement = 
  {eq \
      {qwerty} \
      { ${extract {1} {:} \
           {${lookup{shikut}lsearch{/usr/local/etc/exim/domains/virus22.com/passwd}{$value}fail}} \
         } \
      } \
  }



>     and there is Exim output:


> Failed: failed to open /usr/local/etc/exim/domains/virus22.com/passwd for
> linear search: No such file or directory


>     I know that directory 'virus22.com' does not exists... But Exim doing
> lookup for the second part of 'and', when the first is 'false'...


>     If change 'virus22.com' to 'virus.com' (and I know that directory
> exists) - there is no problem.


>     Where I'm mistaken?


Well the exim spec seems to be quite positive about condition B not being
evaluated if condition A is false (when checking A and B). However, I
remember having encountered similar problems as you describe, this is
why you have to write your stuff differently.

Bernard Stern, SWITCH