[exim] Issues with headers_remove in router ::

Top Page
Delete this message
Reply to this message
Author: Shamim Shahriar
Date:  
To: Exim-users
Subject: [exim] Issues with headers_remove in router ::
Dear List members

I have several exim installations with mysql backend. I decided to
update them all to the latest version, and started with a non-trivial
one, when things seem to go not as planned.

In my virtual_domain router, I have a section that goes like below (this
is the vexim installation, currently available from the github
(https://github.com/avleen/vexim2)

 headers_remove = ${if or { { <{$spam_score_int}{1} } \
               { <{$spam_score_int}{${lookup mysql{select users.sa_tag *
10 from users,domains \
               where localpart = '${quote_mysql:$local_part}' \
               and domain = '${quote_mysql:$domain}' \
               and users.on_spamassassin = '1' \
               and users.domain_id=domains.domain_id }{$value}fail}} } \
               { eq {0}{${lookup mysql{select users.sa_tag * 10 from
users,domains \
               where localpart = '${quote_mysql:$local_part}' \
               and domain = '${quote_mysql:$domain}' \
               and users.on_spamassassin = '0' \
               and users.domain_id=domains.domain_id}{$value}fail}}} \
                       } {X-Spam-Score::X-Spam-Report} }


Whenever any email hits this section, I get an error like below (and
needless to say, the delivery fails and the mail is passed to the retry
section)

12:45:59 63676 expanding: $spam_score_int
12:45:59 63676    result: 27
12:45:59 63676 expanding: 1
12:45:59 63676    result: 1
12:45:59 63676 expanding: $spam_score_int
12:45:59 63676    result: 27
12:45:59 63676 failed to expand: select users.sa_tag * 10 from
users,domains where local
12:45:59 63676    error message: missing } at end of string
12:45:59 63676 failed to expand: ${lookup mysql{select users.sa_tag * 10
from users,domains where local
12:45:59 63676    error message: missing } at end of string
12:45:59 63676 failed to expand: ${if or { { <{$spam_score_int}{1} } {
<{$spam_score_int}{${lookup mysql{select users.sa_tag * 10 from
users,domains where local
12:45:59 63676    error message: missing } at end of string inside
"or{...}" condition
12:45:59 63676 virtual_domains router: defer for postmaster@???
12:45:59 63676   message: virtual_domains router failed to expand "${if
or { { <{$spam_score_int}{1} } { <{$spam_score_int}{${lookup
mysql{select users.sa_tag * 10 from users,domains where localpart =
'${quote_mysql:$local_part}' and domain = '${quote_mysql:$domain}' and
users.on_spamassassin = 1 and
users.domain_id=domains.domain_id}{$value}fail}} } { eq {0}{${lookup
mysql{select users.sa_tag * 10 from users,domains where localpart =
'${quote_mysql:$local_part}' and domain = '${quote_mysql:$domain}' and
users.on_spamassassin = 0 and
users.domain_id=domains.domain_id}{$value}fail}}} }
{X-Spam-Score:X-Spam-Report} }": missing } at end of string inside
"or{...}" condition
12:45:59 63676 added retry item for R:postmaster@???:
errno=-1 more_errno=0 flags=0


Now, I have tried to check if all the curly brackets match and balance,
and they seem to do. I checked (as best as I could) to see if there is
anything missing inside or{...}, and they seem to check and balance as
well. So I am a little confused as to what I am missing here. This used
to work (and still works) on earlier version of Exim (earliest I have
known it to work with Exim v4.80 -- two of my servers are still working
properly or as expected with that version -- it is just that 4.82 seem
to dislike this condition part).

for the last few days I had been trying all possible options --
including googling around for what might be the cause for this to break,
and so far I have come up with nothing. I tried replacing the SELECT
queries with fixed values, replaced entire queries with simple digits,
but still have come up with nothing. Therefore, any pointer/hint/support
is highly appreciated.

Thanks and regards
Shah