Re: [Exim] Questions about database lookups

Página Inicial
Delete this message
Reply to this message
Autor: Jez Hancock
Data:  
Para: Rossz Vamos-Wentworth
CC: Exim-users
Assunto: Re: [Exim] Questions about database lookups
Hi Rossz,

On Sat, Feb 07, 2004 at 06:52:27PM -0800, Rossz Vamos-Wentworth wrote:
> When getting a sql generated list of items that are normally seperated
> by colons, do I need to concat them with colons or can I use the list
> raw. For example, would this work?:
>
> domainlist local_domains = localhost : \
> ${lookup mysql{select unique domain from domains}}


You can just do:

domainlist    local_domains = localhost : \
            mysql;select unique domain from domains


which I believe is syntactically equivalent to what you have in your
example anyway.


FWIW my configure file has this macro (amongst others) at the top:

MYSQL_DOMAIN_LOCALS    = SELECT domain FROM domains WHERE domain='${quote_mysql:${domain}}'


(beware long line wraps :P)

and the local_domains domainlist set up as:

domainlist    local_domains = @ : /etc/mail/local-host-names : \
            mysql;MYSQL_DOMAIN_LOCALS


to create a combination of local_domains we accept mail for from
flatfile and mysql db.

To be honest I don't know how efficient this kludge is but it's been
working fine for several months now.

You can test the setup out with a fake telnet session 'exim -bh 127.0.0.1':

[10:21:03] root@users /var/log/exim# exim -bh 127.0.0.1
helo somedomain.com
mail from:<>
rcpt to:<test@???>

<snip>
>>> somelocaldomain.com in "@ : /etc/mail/local-host-names : mysql;SELECT
>>> domain FROM domains WHERE domain='somelocaldomain.com'"? yes (matched
>>> "mysql;SELECT domain FROM domains WHERE domain='somelocaldomain.com'")



> Another example:
>
> deny message = ${lookup mysql{select message \
>     from blacklists where domain='$dnslist_domain'}}
>   log_message = found in $dnslist_domain
>   dnslists = ${lookup mysql{select unique domain from blacklist}}


Not sure about this one - does it work?

--
Jez Hancock
- System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - Another FreeBSD Diary
http://ipfwstats.sf.net/        - ipfw peruser traffic logging