Re: [exim] Generate hostlist from MySQL

Top Page
Delete this message
Reply to this message
Author: Exim users mailing list
Date:  
To: Jeremy Harris
CC: exim-users
Subject: Re: [exim] Generate hostlist from MySQL
On Tue, Jan 23, 2007 at 12:19:38PM +0000, Jeremy Harris wrote:
> Alexander Shikoff wrote:
> > Is there a way to generate a hostlist from SQL database?
> > I wish to make a hostlist from SQL like from file and then use it
> > in RCPT ACL to match sender's IP address with 'hosts' condition.
>
> http://exim.org/exim-html-4.66/doc/html/spec_html/ch10.html#id2590239


Thanks a lot. I've read that chapter a lot of times before wrote to this
mailing list. What about the case if database field contains not a single
IP-address but a network address? In MySQL there is no way to write
WHERE condition which will match IP-address against address of network.

Example:

SELECT `prefix` FROM `nets` WHERE `class` = 'WHITE' returns '193.0.0.0/21'.

hostlist white_list = mysql;SELECT `prefix` FROM `nets` WHERE `class` = 'WHITE'
acl_check_rcpt:
    warn 
        message = host is white
        hosts = +white_list


'warn' condition in example above will match any host address because a query
to database is always successful.

-- 
Kind Regards,    Alexander Shikoff
minotaur@???
Mob.: +380 67 946 31 49