Re: [Exim] Mysql and exim ( single lookups and lists ) help

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Terry M
CC: exim-users
Tárgy: Re: [Exim] Mysql and exim ( single lookups and lists ) help
On Tue, 17 Dec 2002, Terry M wrote:

> here is one that did not work
> deny hosts = 100.100.105.219 : mysql;SELECT ipblock
> FROM blacklist


It won't. Presumably that select will always succeed. Therefore Exim
will assume that the host it is testing is in the list. That is how that
syntax works. It is designed for statments like

  deny hosts = mysql;select somefield from sometable where
    address=$sender_host_address


I'm not an SQL user; that's just an approximation. The main point is
that it uses the IP address of the host in the query. Actually, if you
use only the address and not the name, you should use net-mysql and not
plain mysql, to save looking up the host name.

Note that you can use ${mask to produce masked IP addresses if you wish,
but you then need a separate lookup for each mask length.

> Here is one that did work.. BUT it will not work
> well with blocks, but will work with IP's
>
> deny hosts = ${lookup mysql {select ipblock from
> blackserver where ipblock like
> '${quote_mysql:$sender_host_address}' } }


I presume that works because you are looking up a list of hosts, because
that is what that syntax does. It replaces the lookup with text from the
database, and then interprets that as a host list.

What are you actually trying to achieve? What is the data in the
database?


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