Author: W B Hacker Date: To: exim users Subject: Re: [exim] Simple greylisting in Exim ACL.
David Woodhouse wrote: > On Fri, 2007-02-09 at 00:19 +0800, W B Hacker wrote:
>> Seems 'not at the moment'.
>>
>> Background:
>>
>> We use the SQL : 'SELECT <SQL DB attribute> AS <dovecot variable>'
>>
>> ..elsewhere.
>>
>> Tests (so far) have show this SQL 'AS' assignment does NOT work in Exim ACL's -
>> whether quoted, bracketed, or $quote_pgsl:'ed, and whether destined for either
>> an acl_<variable> OR a MACRO.
>
> Hm. I'm not sure about 'SELECT foo AS somearbitraryvariable' but we
> _could_ probably make it set a variable named according to the _field_
> name. So a lookup 'SELECT helo,host,expire FROM greylist where blah'
> could set variables like $acl_m_helo, $acl_m_host, $acl_m_expire.
>
> Actually that's a really bad example and we'd probably want to name them
> $sql_helo, $sql_host or something like that. But the nomenclature is
> unimportant. We can now do fairly arbitrary variable names based on a
> common prefix, right?
>
> I wouldn't want to do this in sqlite unless we were going to _also_ do
> it the same way in the other databases.
>
> And of course it only really works like this when there's _one_ result.
> I'm happy enough to declare that it sets the variables according to the
> _last_ result returned by the lookup.
>
> Does that seem like a reasonable feature to implement?
>
It *might* be there now - for someone with a better understanding of the internals.
The 'apparent' need is to expand the 'set acl_C|m(n) =' action along with the
variable named, and to action that from within the SQL call.
Unlike the $1, $2, $3 in an authenticator, or (whatever) in Dovecot, just
supplying the variable or MACRO name alone is not enough - one has to invoke a
transfer or loading 'method' ('set').
I am fully loaded on another project, plane to London to catch tomorrow evening,
thence back to Hong Kong and straight into other projects, so no time to look
until late next week.
Meanwhile - at least with PostgreSQL - there seems to be no 'significant'
advantage, resource-wise, to mapping several attributes with the 'AS' tool in
one go over multiple SELECT, one per each variable to be loaded.
That could be dramatically different for SQLite, and needs to be measured before
re-inventing this particular wheel.