On 8/16/2010 11:04 AM, Timo Sirainen wrote:
On Mon, 2010-08-16 at 10:49 -0700, Marc Perkel wrote:
On 8/15/2010 3:06 PM, Timo Sirainen wrote:
These are available in v2.0:

%{login_user}
%{login_username}
%{login_domain}

I guess they should be added to wiki..
Hi Timo,

I just tried the 2.0 official release and these variables return an
empty string.
Works with me:

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

password_query = \
   SELECT "user", password FROM masters \
     WHERE "user" = '%u' and '%d' = '%{login_domain}'

auth: Debug: sql(mas...@dovecot.org,::1,master): query: SELECT "user", password FROM 
masters WHERE "user" = 'mas...@dovecot.org' and 'dovecot.org' = 'dovecot.org'
auth: Debug: sql(mas...@dovecot.org,::1,master): query: SELECT "user", password FROM 
masters WHERE "user" = 'mas...@dovecot.org' and 'dovecot.org' = 'foobar.org'



Odd - wonder what I'm doing wrong then? My result:

Aug 16 10:44:43 auth: Debug: sql(supp...@junkemailfilter.com,127.0.0.1): query: SELECT user_name, domain_name, password FROM users WHERE user_name = 'support' AND domain_name = 'junkemailfilter.com' AND owns_domain='1' AND 'junkemailfilter.com'=''

My query:

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}'

Reply via email to