[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
warn
set acl_m_dfind = ${lookup mysql\
{SELECT failed FROM dictbl \
WHERE host='$sender_host_address'; \
}{$value}}
# If the above check yielded a null result, set acl_m_dfind to 0
warn
condition = ${if eq\
{$acl_m_dfind}\
{}\
{1}}
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
drop
!hosts = +remote_hosts
message = Too many failed recipients
domains = +local_domains
condition = ${if >\
{$rcpt_fail_count}\
{1}\
{1}{0}}
set acl_m_dict = ${lookup mysql\
{INSERT INTO dictbl \
VALUES ( '$sender_host_address', \
'${eval:$rcpt_fail_count+$acl_m_dfind');}}
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:
'${eval:($rcpt_fail_count)+($acl_m_dfind)');}}
with the same result (expected that but I like to prove to myself thats
the case) and also:
'${eval:$rcpt_fail_count+${sg{$acl_m_dfind}}}');}}
which gives me the following error:
failed to expand ACL string "${lookup mysql{INSERT INTO dictbl VALUES (
'$sender_host_address',
'${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 :)
James
More information about the Pkg-exim4-users
mailing list