Re: [Exim] Problem with quote_mysql

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Phil Pennock
CC: exim-users
Subject: Re: [Exim] Problem with quote_mysql
On Sat, 24 Mar 2001, Phil Pennock wrote:

> On 2001-03-23 at 13:52 +0100, Björn Metzdorf gifted us with:
> > Quick workaround for me is double-quoting:
> >
> > MYSQL_LOCAL_DOMAINS = SELECT DISTINCT MYSQL_DOMAINFIELD FROM MYSQL_AUTHTABLE
> > WHERE MYSQL_USERNAMEFIELD = '${quote_mysql:${quote_mysql:$local_part}}' AND
> > MYSQL_DOMAINFIELD = '${quote_mysql:$domain}' AND MYSQL_ACTIVEFIELD = 'yes'
>
> I've seen that you already have a solution, thanks to Philip Hazel
> (shock horror, what a surprise!) which involves using :: instead
> of : , but since I'm a pedant ...
>
> Since the problem was Exim itself doing the parsing of the results, then
> when doing double-quoting as above, shouldn't the outer quoting be
> against Exim, not against MySQL?
>
> So that would be: '${quote:${quote_mysql:$local_part}}'
>
> Philip? Or would the double-quotes being added cause problems?


Oh, heck. My brain can't get round this one first thing on a Monday
morning, especially after a hard Sunday in the theatre. I think you are
probably right.

For Exim 4, I think I'm going to change the rules so that this problem
doesn't arise. The current state happened by accidents:

1. At first, there were just literal lists like local_parts = x.y : a.b

2. Then simple lookups were added: local_parts = cdb;/some/file

3. Then query-type lookups such as NIS and mysql were invented, and I
realized that some way of getting the key into the query was required,
so I made it expand the items that were query-style lookups.

So far, so good.

4. Then somebody suggested expanding the values of the local_parts and
domains options in drivers, and so I expanded the whole string. This
lead to the double expansion that currently happens.

I am considering making it different in Exim 4, and expanding each item
in the local_parts and domains (and senders) options separately. And
just once.



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