Re: [exim] Condition Problem

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Phil Pennock
Datum:  
To: a a
CC: exim users
Betreff: Re: [exim] Condition Problem
On 2007-12-12 at 17:39 +0100, a a wrote:
> condition = ${if or {{ > {$acl_c1} {70} {${lookup {$sender_address} lsearch
> {FILE} {0} {1}}}} { > {$spam_score_int} {70} {${lookup
> {$sender_address_domain} lsearch {FILE} {0} {1}}}}}}


It's a conceptual problem; the braces balance but that doesn't matter
because it's a syntax error and semantically a bit iffy.

There are expansion strings; within strings, some expansion operators
take expansion conditions. An expansion condition has to return
boolean, true/false. The operators which take conditions are ${if} and
${filter}; two conditions let you next other conditions, 'and' and 'or'.

You've mixed up condition logic with ${if} expansions. A condition is
not a nested ${if}; ${if} uses conditions to return an arbitrary string,
whereas a condition is just a predicate and can only say "yes" or "no"
(or equivalent other boolean labels).

Where you wrote:
{ > {$acl_c1} {70} {${lookup {$sender_address} lsearch {FILE} {0} {1}}}}
it would be valid to write:
{ > {$acl_c1} {70} }
but ">" is not an ${if} on its own; it compares two items and that's
all. {>{$acl_c1}{70}} allows the _surrounding_ ${if} to then expand
other expansion strings, but that's all.

Your requirement appears to be:
  if $acl_c1 > 70 then
    true if $sender_address not listed in FILE
  else if $spam_score_int > 70 then
    true if $sender_address_domain not listed in FILE
where $spam_score_int isn't examined when $acl_c1 <= 70, even if
$sender_address is listed in the file.  This last point means that you
can't use or{} at the top level.


Also, are you sure you don't want >= instead of > ? I'll use >= below.

You need to do something like this (untested):

 condition = ${if >={$acl_c1}{70} \
               {${lookup {$sender_address} lsearch{FILE} {no}{yes}}}\
               {${if >={$spam_score_int}{70} \
                  {${lookup {$sender_address_domain} lsearch{FILE} {no}{yes}}}\
                  {no}}}}


-Phil