Re: [Exim] Exim named lists

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Yann Le Guennec
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] Exim named lists
On 23 May 2002, Yann Le Guennec wrote:

>    SQL_RELAYFROMHOST=select SQL_DATAFIELD from SQL_TABLE \
>                        where SQL_TYPEFIELD='relayfromhost'

>
>    hostlist relay_from_hosts = mysql;SQL_RELAYFROMHOST


I think you may be confused as to what that statement actually means.
That syntax means this:

"Find the name of the connected host by looking up its IP address in
the DNS. Place the name in $sender_host_name. Then run the MySQL
query. If the query is successful, the host is in this list. Otherwise
it is not in the list."

Since you are not referring to $sender_host_name anywhere in your query,
this is never going to work.

> How can I match on IPs with lists and lookup ?


If you use "net-mysql" instead of "mysql", Exim does not do the host
lookup. Using "net-" tells it that you are going to use only the IP
address. However, you still haven't referred to $sender_host_address in
your query, so that won't help.

>    accept hosts = ${lookup mysql {SQL_RELAYFROMHOST} {$value}{false}}

>
> and that works... Is that the way to do it or am I missing something ?


That is doing something completely different. That is saying this to
Exim:

"Run that MySQL query. If it succeeds, use the result of the query as
a host list. If it fails, use the string 'false' as a host list. Check
the incoming host against the host list you have looked up."

Host lists can contain names or IP addresses.



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