Re: [Exim] mysql lookup for relay_domains

Etusivu
Poista viesti
Vastaa
Lähettäjä: Brian West
Päiväys:  
Vastaanottaja: o.cook, exim-users
Aihe: Re: [Exim] mysql lookup for relay_domains
This will not work in the relay_domains setup. $key is what we are looking
for and if '$key=mail.domain.com' then '%$key' will not match 'domain.com'
from the database but SUBSTRING_INDEX('$key', '.',-2) will match
anything.domain.com.

if 'domain.com' is listed in the database:

if $key=mail.domain.com then
SELECT domain FROM domain WHERE domain LIKE '%$key'
this query would not match anything in the database at all, since
mail.domain.com is not in the database.

but
SELECT domain FROM domain WHERE domain LIKE SUBSTRING_INDEX('$key', '.',-2)
this query would take $key and make it eq domain.com then it would match and
allow relay.

Plus you can get some conditions where the % will not work such as the
relay_domains setup. This will allow you to just enter domain.com and this
would allow anything.domain.com to relay without entering every host name
you want to relay.
Later,
Brian



----- Original Message -----
From: <o.cook@???>
To: <exim-users@???>
Sent: Sunday, July 16, 2000 9:48 AM
Subject: RE: [Exim] mysql lookup for relay_domains


> You can do:
>
> SELECT domain FROM domain WHERE domain LIKE "%.co.uk"
>
> which would match anything ending in .co.uk
>
> % is the wildcard.
>
> Ol.
>
> -----Original Message-----
> From: Philip Hazel [mailto:ph10@cus.cam.ac.uk]
> Sent: 14 July 2000 20:28
> To: Brian K. West
> Cc: Nancy Pettigrew; exim-users@???
> Subject: Re: [Exim] mysql lookup for relay_domains
>
>
> On Fri, 14 Jul 2000, Brian K. West wrote:
>
> > You can also use:
> >
> > SELECT domain FROM domain WHERE domain LIKE SUBSTRING_INDEX('$key', '.',
> -2)
>
> and I seem to recall that there is a pattern matching facility in SQL,
> isn't there? Can't you look up "ends with" by this means?
>
>
> --
> Philip Hazel            University of Cambridge Computing Service,
> ph10@???      Cambridge, England. Phone: +44 1223 334714.

>
>
> --
> ## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
> details at http://www.exim.org/ ##
>
> --
> ## List details at http://www.exim.org/mailman/listinfo/exim-users Exim

details at http://www.exim.org/ ##
>
>