[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Courier authmysql does not query DB



On Wed, 2006-11-15 at 15:36 +0100, Jan Dinger wrote:
> On Wed, 15 Nov 2006 08:03:48 -0500
> David Clymer <david@zettazebra.com> wrote:
> 
> > I'm trying to integrate courier-imap with my msyql based virtual
> > domain/user setup. 
> > 
> > The problem that I am having is that whenever I activate the
> > MYSQL_SELECT_CLAUSE, the database is not queried. A connection to the
> > database server is still established, but no query is made. When NOT
> > using the MYSQL_SELECT_CLAUSE, the database _is_ queried (I'm logging
> > all queries, so it shows up in the mysql query log), but not in the way
> > that I need.
> > 
> > This is my authmysqlrc:
> > 
> > 
> > MYSQL_SERVER    mysql.hrcsb.org
> > MYSQL_USERNAME  mail
> > MYSQL_PASSWORD  ********
> > MYSQL_PORT      3306
> > MYSQL_OPT       0
> > MYSQL_DATABASE  mail
> > MYSQL_SELECT_CLAUSE     SELECT account.username,\
> >                         account.crypt_password,\
> >                         account.password,\
> >                         account.uid,\
> >                         account.gid,\
> >                         CONCAT('/var/mail/', domain.name, '/'),\
> >                         account.maildir,\
> >                         account.quota,\
> >                         '',\
> >                         ''\
> >                         FROM account \
> >                         INNER JOIN domain ON account.domain_id = domain.name \
> >                         WHERE account.username = '$(local_part)'\
> >                         AND domain.name = '$(domain)'
> > 
> > 
> > I'm running debian sarge, and the debian package of courier-{imap,
> > authdaemon,authmysql}. The database is on a remote machine and is
> > running mysql 4.1
> > 
> > Any ideas/experience you might have would be very welcome.
> > 
> > -davidc
> > 

> Hi David,
> 
> take a look in this howto http://workaround.org/articles/ispmail-sarge/
> 
> ive tested this howto on sarge, etch and sid - no problem
> 

Thanks. Unfortunately, my problem is not any of the other portions of
the setup - just a particular configuration issue with
courier-authmysql.

I've worked around the issue so that IMAP (all I want courier for is to
do IMAP) works for one domain, but if I want to support multiple
domains...I'm still screwed.

Since it seems that, for courier, all the field name settings in the
config are merely strings that it slaps together in a certain order, I
can build almost any SQL query I like.

So, in order to join two tables, I set MYSQL_TABLE like so:

MYSQL_TABLE	account INNER JOIN domain ON account.domain_id = domain.id

then, I can build the home or maildir path using the domain name, and
set a MYSQL_WHERE_CLAUSE to this:

MYSQL_WHERE_CLAUSE	domain.name = 'test.org'

I'm still looking for a solution to the MYSQL_SELECT_CLAUSE issue
though, so further suggestions on that, please share.

-davidc

-- 
gpg-key: http://www.zettazebra.com/files/key.gpg

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: