[Pkg-exim4-users] Unable to eval from acl_m variable

James Riach james at jriach.co.uk
Tue Aug 11 23:38:46 UTC 2009

Hi list,

I'm trying to setup some very basic blacklisting of hosts that 
consistently fail to pass some of my acl statements so as to deny them 
earlier in the smtp transaction.

I have setup a basic mysql table to contain the data.

So far I have a lookup of the database working fine as follows:

# Check if host has failed recipient verification in the past
        set acl_m_dfind    = ${lookup mysql\
                                   {SELECT failed FROM dictbl \
                                   WHERE host='$sender_host_address'; \

# If the above check yielded a null result, set acl_m_dfind to 0
        condition        = ${if eq\
        set acl_m_dfind    = 0

My issue is with the next acl that drops if $rcpt_count > 1, this is 
where I want to INSERT the host into the table thus I have:

# Drop connection if more than three recipients fail to verify
        !hosts        = +remote_hosts
        message    = Too many failed recipients
        domains    = +local_domains
        condition    = ${if >\
        set acl_m_dict = ${lookup mysql\
                                {INSERT INTO dictbl \
                                VALUES ( '$sender_host_address', \

The above statement leaves me with the following error in mainlog:

failed to expand ACL string "${lookup mysql{INSERT INTO dictbl VALUES ( 
'$sender_host_address', '${eval:$rcpt_fail_count+$acl_m_dfind');}}": 
error in expression evaluation: expecting operator (after processing "3+0")

So I've tried changing the eval part of the lookup to read:


with the same result (expected that but I like to prove to myself thats 
the case) and also:


which gives me the following error:

failed to expand ACL string "${lookup mysql{INSERT INTO dictbl VALUES ( 
'${eval:$rcpt_fail_count+${sg{$acl_m_dfind}}}');}}": missing or 
misplaced { or }

I'm sure I'm just mis-understanding something, but having a tough time 
figuring it out; think I just need a finger pointing out my mistake :P

I know the above is a bit crude, but it's more of a proof of concept as 
this is the first time I've tried to have Exim talk to a mysql database

Thanks in advance for any help :)


More information about the Pkg-exim4-users mailing list