I am doing a mysql lookup something like this:

        ${lookup mysql{SELECT home, uid, gid FROM users WHERE userid = 
'$local_part' and domain = '$domain'}}

It works -- in isolation. The problem is that I have more than one different 
database that
exim may play with (I am running the greylisting code that I put out a few 
weeks ago).

These are different databases with a different username/password. How to handle 
in exim:

        ${lookup 
mysql{servers=localhost(/var/lib/mysql/mysql.sock)/imap/exim_auth/YYYYY; SELECT 
home, uid, gid FROM users WHERE userid = '$local_part' and domain = '$domain'}}

this works, but it puts a username/password in the exim config file - that I 
want to avoid.

I have in a file included:

        hide mysql_servers = localhost/exim_db/exim_user/XXXXXX:\
                             localhost/imap/exim_auth/YYYYY

So I tried:

        ${lookup mysql{servers=localhost/imap; SELECT home, uid, gid FROM users 
WHERE userid = '$local_part' and domain = '$domain'}}

but that doesn't work since the argument to servers is either the name of the 
server, or all 4 parts.

        hide mysql_servers = localhost/exim_db/exim_user/XXXXXX:\
                             
localhost2(/var/lib/mysql/mysql.sock)/imap/exim_auth/YYYYY

I need the socketname since localhost is recognised specially.

        ${lookup mysql{servers=localhost2; SELECT home, uid, gid FROM users 
WHERE userid = '$local_part' and domain = '$domain'}}

Doesn't work.

OK: how about a fix where the servers= could have a varying number of 
parameters, if it
has not got the full 4 it tries to fill them in from what it finds in 
mysql_servers
where the number of paramaters that it has got matches.
In short: my first attempt where I specify ''servers=localhost/imap;'' would 
work as I
had hoped.

The other way of doing it would be to give the generic exim user read access to 
the 'users' table and specify the table as imap.users:

        ${lookup mysql{SELECT home, uid, gid FROM imap.users WHERE userid = 
'$local_part' and domain = '$domain'}}

If this is thought a good idea I will do the coding work.

Regards

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>

-- 
## List details at http://lists.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to