[Dovecot] SQL user_query question

John Dubchak john.dubchak at elitesoftwarearchitects.com
Thu Jan 24 14:10:09 EET 2008


Hi,

I am working through setting up a virtual hosting system using  
Dovecot, Postfix and Postgres on a CentOS 5 box running an install of  
the dovecot-1.0-1.2.rc15.el5 RPM.

The question I have is, given this password_query SELECT clause, which  
all return valid values from the database:

user
password
domain

can I use a %d in the WHERE clause of my user_query?  The reason I ask  
is that the log file shows the results coming back correctly for the  
password_query in the log file:

dovecot: auth(default): client out: OK	1	user=user1	domain=domain.com

Yet, the user_query that is logged shows:

dovecot: auth(default): sql(user1,192.168.0.77): SELECT  
vu.virtual_mailbox AS home, vu.virtual_uid AS uid, vu.virtual_gid AS  
gid, vd.domain AS domain FROM virtual_users vu,  
virtual_mailbox_domains vd WHERE vu.domain_key = vd.id AND vu.username  
= 'user1' AND vd.domain = ''

And the actual query in my dovecot-sql.conf looks like this:

user_query = SELECT vu.virtual_mailbox AS home, vu.virtual_uid AS uid,  
vu.virtual_gid AS gid, vd.domain AS domain FROM virtual_users vu,  
virtual_mailbox_domains vd WHERE vu.domain_key = vd.id AND vu.username  
= '%u' AND vd.domain = '%d'

I would have expected the above %d to contain the "domain" SELECT  
value from the password_query, but that doesn't seem to be the case.

Any insight is most appreciated.

Thanks,
John


More information about the dovecot mailing list