Re: [Exim] rlike in MySQL

Pàgina inicial
Delete this message
Reply to this message
Autor: Philip Hazel
Data:  
A: dana_booth
CC: exim-users
Assumpte: Re: [Exim] rlike in MySQL
On Thu, 21 Mar 2002, dana_booth wrote:

> Tsa, na chitu... I want to use MySQL lookups in an acl. One of them works
> just fine, it's a locally maintained "bad list", and the RCPT check checks
> the $sender_host_address against "bad" IP addresses kept in a table. However,
> I also want to check $sender_host_name against some partial names kept in
> another table. I send the command "select hostname from bad_hostnames where
> '$sender_host_name' rlike hostname". I've also tried to enclose the where
> expression in parenthesis, but I never get a hit.


The problem is probably that Exim has not looked up the sender host
name, so $sender_host_name is not set. Exim doesn't do a reverse DNS
lookup by default, only when it needs to. Unfortunately, it isn't clever
enough to realise that a use of $sender_host_name means that it should
do a lookup.

This is a point that I hadn't really thought about for Exim 4, where the
use of the variable is more likely than it is in Exim 3. I will think
about it, and maybe find a way of automating this so that a reference to
$sender_host_name forces a lookup.

Meanwhile, the only thing you can do is to add something to your
configuration that causes the lookup to happen. Two ideas:

1. Set the host_lookup option to explicitly ask for a lookup.

2. In the ACL where you want to use $sender_host_name, insert a "hosts"
option that checks for some host name by wildcard. For example:

        hosts     = ! *.force.a.lookup
        condition = something that uses $sender_host_name


The wild card in *.force.a.lookup will cause Exim to do a reverse
lookup, but of course the name will never match, so that condition will
always be true.

However, note that many hosts are not reverse-registered in the DNS, so
Exim won't be able to find their names. In this case the name remains
unset.

Philip

--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.