[Dovecot] SQL user_query question
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
John Dubchak, on 1/24/2008 7:10 AM, said the following:
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.
--
Best regards,
Charles
On Jan 24, 2008, at 7:48 AM, Charles Marcus wrote:
That's an old/buggy version - please update to a release version
(1.0.10 is current)
Hi Charles,
Thanks for the information, however, the result is still the same and
the log file results indicate that in my user_query, '%d' in the WHERE
clause is being expanded with no value.
Is there something else I should be trying?
Thanks, John
On Thu, 2008-01-24 at 06:10 -0600, John Dubchak wrote:
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.
Your password_query most likely dropped the domain by returning user field as Dovecot's "user" field. Have it return instead something like:
password_query = select concat(user, '@', domain) as user, ...
participants (3)
-
Charles Marcus
-
John Dubchak
-
Timo Sirainen