Re: [exim] Bug in string expansion of exim configuration?

Pàgina inicial
Delete this message
Reply to this message
Autor: Forum
Data:  
A: exim-users
Assumpte: Re: [exim] Bug in string expansion of exim configuration?
Am 22.12.2016 um 13:41 schrieb Heiko Schlittermann:
>
>> But when i try get the values for spam it fails!
>> That's what i want to do:
>>
>>        condition = ${if >{$spam_score_int}{${eval:10*{${lookup mysql{ SELECT DISTINCT spam_threshold FROM user WHERE
>> username='${quote_mysql:$local_part}' AND domain='${quote_mysql:$domain}' AND SMTP_allowed='YES'}}}}}{true}{false}}

>>
>>
>> This will result in:
>>
>> temporarily rejected after DATA: failed to expand ACL string
>> "${if >{$spam_score_int}{${eval:10*{${lookup mysql{ SELECT DISTINCT spam_threshold FROM user WHERE
>> username='${quote_mysql:$local_part}' AND domain='${quote_mysql:$domain}' AND SMTP_allowed='YES'}}}}}{true}{false}}":
>> error in expression evaluation: expecting number or opening parenthesis (after processing "10*")
>>
>> From my point of view the syntax is correct.
>> Can you help me to see the error?
> Syntax is correct, but not the idea behind. In the DATA ACL you can't
> use $local_part, $domain, since you may have multiple recipients.


Okay - i didn't recognize that.
Originally i was working with the base of this configuration:
http://struction.de/projects/HOWTO_VirtualMail_Exim-MySQL-Spamassassin-ClamAV-Dovecot/?set_lang=en&set_style=clean|http://struction.de/projects/HOWTO_VirtualMail_Exim-MySQL-Spamassassin-ClamAV-Dovecot/?set_lang=en&set_style=clean

Specially http://struction.de/projects/HOWTO_VirtualMail_Exim-MySQL-Spamassassin-ClamAV-Dovecot/config/exim/exim.conf

He made very complex exim hacks in the transport configuration:

__________________________________________________________________

  headers_remove = Subject : X-Spam-Flag : X-Spam-Score-Int : X-Spam-Score : X-Spam-Bar : X-Spam-Report 
  headers_add     = "X-Spam-Threshold: ${lookup mysql{ \
                           SELECT spam_threshold \
                    FROM user \
                    WHERE username='${quote_mysql:$local_part}' \
                    AND domain='${quote_mysql:$domain}' \
                    AND SMTP_allowed='YES' \
                      }{$value}{ERROR}}\n\
            X-Spam-Score: $header_X-Spam-Score:\n\
          X-Spam-Score-Int: $header_X-Spam-Score-Int:\n\
          X-Spam-Bar: $header_X-Spam-Bar:\n\
          X-Spam-Report: $header_X-Spam-Report:\n\
                  X-Spam-Flag: ${if def:header_X-Spam-Score-Int:{\
                     ${if >={${eval:${sg{$header_X-Spam-Score-Int:}{^.*\n}{}}}}\
                         {${lookup mysql{ \
                            SELECT spam_threshold*10 \
                            FROM user \
                            WHERE username='${quote_mysql:$local_part}' \
                            AND domain='${quote_mysql:$domain}' \
                            AND SMTP_allowed='YES' \
                        }{$value}{ERROR}}}{YES}{NO}}\
                    }{\
                    UNKNOWN\
                }}\n\
          Subject: ${if def:header_X-Spam-Score-Int:{\
                     ${if >={${eval:${sg{$header_X-Spam-Score-Int:}{^.*\n}{}}}}\
                        {${lookup mysql{ \
                            SELECT spam_threshold*10 \
                            FROM user \
                            WHERE username='${quote_mysql:$local_part}' \
                            AND domain='${quote_mysql:$domain}' \
                            AND SMTP_allowed='YES' \
                        }{$value}{ERROR}}}{${lookup mysql{ \
                                    SELECT spam_tag \
                                    FROM user \
                                    WHERE username='${quote_mysql:$local_part}' \
                                    AND domain='${quote_mysql:$domain}' \
                                    AND SMTP_allowed='YES' \
                                   }{$value}{ERROR}}$h_subject:}{$h_subject:}}\
                }{$h_subject:}}\n\
          X-Delivered-To: $original_local_part@$original_domain ($local_part@$domain)\n\
          X-Message-Age: $message_age"



__________________________________________________________________


My problem was that these complex expressions did work in Exim version 4.80 in Debian wheezy,
but now they make problems.
I did'nt want to add the spam recognition to each transport.



> Though there is some $recipients variable, you can iterate through. But,
> you can't use the results, as in the DATA ACL you reject or accept the
> *message* for all recipients only. Not for a single recipient.


O.K. Then i will use here only a static value for every email.

Or i have to implement this feature in each transport section.

> You can offer PRDR and the acl_smtp_data_prdr, to return different
> responses for different recipients. But you can't rely on the sending
> client to support PRDR.


Sorry I can't follow you.
Maybe you have a link to some examples for this?

>
> For clients not supporting PRDR you can single out every recipient after
> the first, using $recipients_count and defer. After this you're sure,
> that your DATA ACL needs to care about a single recipient only.


Best regards
Karsten