Chris Knipe wrote:
> Hi,
>
> Just one more quicky that's giving me grief. From the debug, it seems the
> if eq refuses to match, and therefore doesn't return anything....
>
> Debug:
>>>> processing "deny"
>>>> check condition = ${if eq {${lookup mysql{SELECT LocalPart FROM
>>>> Exim_Recipient_Map LEFT JOIN Exim_DomainList ON
>>>> Exim_Recipient_Map.DomainID=Exim_DomainList.EntryID LEFT JOIN
>>>> Exim_ACLList ON Exim_Recipient_Map.DomainID=Exim_ACLList.DomainID WHERE
>>>> Exim_DomainList.isActive='y' AND Exim_ACLList.reqReciptVerify='y' AND
>>>> Exim_Recipient_Map.LocalPart='${quote_mysql:$local_part}' AND
>>>> Exim_DomainList.DomainName='${quote_mysql:$domain}' LIMIT
>>>> 1}}}{${local_part} {yes}{no}}
>>>> =
>>>> deny: condition test failed
It looks like your bracketing is wrong. The last line should be:
1}}}{$localpart}{yes}{no}}
However, there's two levels of redundancy in there: firstly, ${if}'s
results default to {yes}{no}, so you don't need the final {yes}{no}
there. Secondly, $localpart has if/else semantics itself, so you don't
even need the ${if eq} in the first place. Just use:
condition = ${lookup mysql{SELECT LocalPart ..... LIMIT 1}{yes}{no}}
Or, even cleaner:
condition = ${lookup mysql{SELECT COUNT(*) FROM Exim_Recipient_Map LEFT
JOIN Exim_DomainList ON Exim_Recipient_Map.DomainID =
Exim_DomainList.EntryID LEFT JOIN Exim_ACLList ON
Exim_Recipient_Map.DomainID = Exim_ACLList.DomainID WHERE
Exim_DomainList.isActive = 'y' AND Exim_ACLList.reqReciptVerify = 'y'
AND Exim_Recipient_Map.LocalPart = '${quote_mysql:$local_part}' AND
Exim_DomainList.DomainName = '${quote_mysql:$domain}'}}
- Marc