RE: [Exim] partial-mysql query question

Pàgina inicial
Delete this message
Reply to this message
Autor: Tom Bell
Data:  
A: Mark McRitchie, E-mail
Assumpte: RE: [Exim] partial-mysql query question
Howdy again,
            Ok from what I understand from this quote in the manual..


If the pattern starts with `@@<lookup-item>' (for example,
`@@lsearch;/some/file'), the address that is being checked is split into
a local part and a domain. The domain is looked up in the file. If it is
not found, there is no match. If it is found, the data that is looked up
from the file is treated as a colon-separated list of local part
patterns, each of which is matched against the subject local part in
turn. The lookup may be a partial one, and/or one involving a search for
a default keyed by `*'.

.. is that I search the host field in my table for a domain and if I get
a hit I returned a colon separted list of local parts for it to match
against. The idea of partial being that I can ban frank.test.com &
bob.test.com by having an entry with *.test.com in the host field and my
colon seperated list of local parts in the user field that is returned
by the query.

So once again I ask, should partial matching work with mysql ? eg.

@@partial-mysql;select user from reject_users where host like '${key}'

Thanx again for time.

Tom Bell
-----Original Message-----
From: Mark McRitchie <Mark.McRitchie@???>
To: 'Tom Bell' <Tom@???>
Date: Fri, 9 Aug 2002 10:56:58 +0100
Subject: RE: [Exim] partial-mysql query question

> Hi Tom,
>
> its my understanding that you need mysql to return a * BUT your
> matching on
> the domain.
> Your SQL: select user from reject_users where host like '${key}'
>
> you want user to be * but as your doing a LIKE match on the key, that
> part
> of the data needs to be "%.test.com".
>
> Oh, and you might need to reverse the where clause to get it to work:
> SELECT user FROM reject_users WHERE '${key}' LIKE host
>
> as the host is supplying the pattern, not ${key}... be wary of matching
> multiple rows and thus multiple users in this fashion.
>
> HTH
>
> Regards,
> Mark.
>
>