[Dovecot] Master Login using MySQL problem - %{login_domain}

Marc Perkel marc at perkel.com
Tue Aug 17 18:50:51 EEST 2010


  Hi Timo,

Been trying to track this problem down further. The problem seems to be 
related to verifying the master user failing.

My passdb looks like this:

passdb {
   driver = sql
   args = /etc/dovecot/dovecot-domain-owner-sql.conf
   master = yes
   pass = yes
}

dovecot-domain-owner-sql.conf contains:

user_query = SELECT user_name, domain_name FROM users WHERE user_name = 
'%n' AND domain_name = '%d' AND owns_domain='1'

password_query = SELECT user_name, domain_name, password FROM users 
WHERE user_name = '%n' AND domain_name = '%d' AND owns_domain='1' AND 
'%d'='%{login_domain}'

In this example - bill at plf.net is an ordinary user. tom at plf.net is a 
domain owner. Tom wants to read bills email.

The login is: bill at plf.net*tom at plf.net

This results in tom at plf.net being classified as an unknown user.

Aug 17 08:38:30 auth: Debug: sql(tom at plf.net,127.0.0.1): query: SELECT 
user_name, domain_name, password FROM users WHERE user_name = 'tom' AND 
domain_name = 'plf.net' AND owns_domain='1' AND 'plf.net'=''
Aug 17 08:38:30 auth: Info: sql(tom at plf.net,127.0.0.1): unknown user
Aug 17 08:38:32 auth: Debug: client out: FAIL   15      user=tom at plf.net
Aug 17 08:38:32 imap-login: Info: Aborted login (auth failed, 1 
attempts): user=<tom at plf.net>, method=PLAIN, rip=127.0.0.1, 
lip=127.0.0.1, mpid=0, secured

Note that the query used to determine that tom at plf.net is valid is the 
password_query and not the user_query resulting in unknown user. I think 
that's where the problem is.



More information about the dovecot mailing list