Re: [exim] Issues with headers_remove in router ::

Top Page

Reply to this message
Author: Shamim Shahriar
Date:  
To: Jeremy Harris
CC: exim-users
Subject: Re: [exim] Issues with headers_remove in router ::
Hi Jeremy,

Just to check if my understanding of the problem is correct, I modified the
headers_remove section (without adding the bracket you suggested) in the
two following ways

#=== Way 01 :: hard coded value ===
  headers_remove = ${if or { { <{$spam_score_int}{1} } \
    { <{$spam_score_int} {20}} \
    { eq {0}{10}} \
    } {X-Spam-Score::X-Spam-Report} }


#================

#=== way 02 :: empty value ===
 headers_remove = ${if or { { <{$spam_score_int}{1} } \
               { <{$spam_score_int}{${lookup mysql{}{$value}fail}} } \
               { eq {0}{${lookup mysql{}{$value}fail}}} \
              } {X-Spam-Score::X-Spam-Report} }
#=============


In both cases, the emails were delivered as expected.

Therefore, I think it is a stronger possibility that somehow exim is unable
to expand the section inside lookup mysql{......}. Given that the query is
correct (I tried with fixed values from command line in mysql, and they
both came up with an empty value (in other words, "No rows."). So I think
it is safe to check if the "fail" is actually working, or how is that fail
behaving with respect to the or {...}. But then again, not being a coder
myself I might be completely off track -- I'll leave the debugging to you.

If you'd like me to run any other test, please do let me know, and I'll see
how much I can do.

Thanks again
Shah


On 5 September 2014 13:42, Shamim Shahriar <shamim.shahriar@???>
wrote:

> Thanks Jeremy, I revisited the conditions, and once I got rid of all the
> text inside the brackets, this is what the barebone version comes to
>
> ${if or
>        {
>           { <{ } { } } \
>           { <{ }{ ${mysql{ '${}' '${}' }{} }} } \
>           { {0}{${mysql{ '${}' '${}' }{} }}} \
>        } {X-Spam-Score::X-Spam-Report}
> }

>
> As you can see, there is a closing bracket right before the if-result,
> which is against the "or{". Also, the three conditions inside OR { } does
> begin and close where expected.
>
> However, in order to make sure that I am not miscalculating, I added one }
> right where you pointed, and below are the results
>
> 07:49:13 24368 failed to expand: select users.sa_tag * 10 from
> users,domains where local
> 07:49:13 24368    error message: missing } at end of string
> 07:49:13 24368 failed to expand: ${lookup mysql{select users.sa_tag * 10
> from users,domains where local
> 07:49:13 24368    error message: missing } at end of string
> 07:49:13 24368 failed to expand: ${if or { { <{$spam_score_int}{1} } {
> <{$spam_score_int}{${lookup mysql{select users.sa_tag * 10 from
> users,domains where local
> 07:49:13 24368    error message: missing } at end of string inside
> "or{...}" condition
> 07:49:13 24368 virtual_domains router: defer for postmaster@???
> 07:49:13 24368   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

>
>
> As it seems, it is still thinking there is one missing curly bracket.
> Strange!
>
> Any other thoughts?
>
> Thanks again for your help.
>
> Regards
> Shah
>
>
> On 5 September 2014 12:37, Jeremy Harris <jgh@???> wrote:
>
>> On 05/09/14 12:10, Shamim Shahriar wrote:
>> > Hello Jeremy
>> >
>> > Thank you for your reply. I tried that, and below is the modified
>> > headers_remove section
>> >
>> >   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} }

>>
>> If I'm counting brackets right, you have
>>
>>  {if
>>    or {    { cond1 }
>>            { cond2 }
>>            { cond3 }

>>
>>                               <<<<<<<<<< MISSING

>>
>> { if-result }
>>
>> }
>>
>> --
>> Cheers,
>> Jeremy
>>
>> --
>> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
>> ## Exim details at http://www.exim.org/
>> ## Please use the Wiki with this list - http://wiki.exim.org/
>>
>
>