Mailing List Archive

Exim named lists
--
Hi,

I'm trying to use exim-4.04 with a database and I stuck on
something strange :

Here are some bits of my configuration file :


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

hostlist relay_from_hosts = mysql;SQL_RELAYFROMHOST


In the ACL acl_check_rcpt provided with the sample config, if I put :

accept hosts = +relay_from_hosts

exim never match it because it cannot resolve the host (the database
provides a list of IPs). It seems normal as relay_from_hosts is a
hostlist. But if I put IPs instead of the SQL lookup, it does the
matching against the IPs.

How can I match on IPs with lists and lookup ?

The solution I found is to put the SQL lookup directly in the ACL,
without passing through a named list :

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

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

Yann.

--
Content-Description: This is a digitally signed message part

[ signature.asc of type application/pgp-signature deleted ]
--
Re: Exim named lists [ In reply to ]
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@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: Exim named lists [ In reply to ]
--
Actually. my query had included " and SQL_DATAFIELD='$sender_host_name'"
from the start but I have removed it to try different possibilities.

I knew there were something like net-mysql to make it work, it seems to
be the trick... I try it at once.

Thanks a lot for these explanations. I think I understand it better.

Maybe the paragraphs you put to explain my problem could be included in
the documentation, I think they really explain what happens in the
detail...

Yann.

On Fri, 2002-05-24 at 09:44, Philip Hazel wrote:
> 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

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

--
Content-Description: This is a digitally signed message part

[ signature.asc of type application/pgp-signature deleted ]
--