On 2016-05-02 11:32, Carl Jeptha wrote:
password_query = \
      SELECT username AS USER, \
    IF(cryptpwd IS NULL OR cryptpwd='', CONCAT('{PLAIN}',clearpwd),
cryptpwd) AS PASSWORD, \
    '/var/vmail/%d/%n' as userdb_home, \
'maildir:/var/vmail/%d/%n' as userdb_mail, 150 as userdb_uid, 8 as
userdb_gid \
      FROM mailbox \
      WHERE username = '%u' AND active = '1'

You have a right parenthesis after clearpwd in your sql statement
  CONCAT('{PLAIN}',clearpwd),cryptpwd)

  user_query = \
SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' as mail, \
  150 AS uid, 8 AS gid, concat('dirsize:storage=', quota) AS quota \
  FROM mailbox WHERE username = '%u' AND active = '1'

Above is what I have done, but still getting an error:

May  2 05:26:03 |****** dovecot: auth-worker(3442): Error:
sql(u...@domain.tld,xxx.xxx.xxx.xxx): Password query must return a
field named 'password'

For testing purposes I put the query in PHPMyAdmin and it complains this
(notice it drops "PASSWORD", but shows it in the query:
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '\
    IF(cryptpwd IS NULL OR cryptpwd='', CONCAT('{PLAIN}',clearpwd),
cryptpwd) as ' at line 1
The PHPMyAdmin error message shows the relevant part to inspect.

--
Christian Kivalo

Reply via email to