On Wed, 30 Mar 2005 22:27:38 +0200 Jakob Hirsch <jh@plonk.de> wrote:
If you want to allow logins as UsEr1 (and let him access user1's mail), you have to change your dovecot.conf, I think. Use %h instead of %u there, and let user_query return the home directory with something like 'SELECT CONCAT('/var/spool/vmail/',LOWER(userid)) AS home, ...'.
OK, I see where it SHOULD work as I'd like. But it's not for some reason. When I try to log in via Squirrelmail it pops up this:
ERROR : Connection dropped by imap-server.
Query: CAPABILITY
Here's the appropriate section of dovecot.conf (what it WAS, and what is set to now)
#auth_userdb = static uid=5000 gid=5000 home=/home/vmail/%d/%u
auth_userdb = mysql /etc/dovecot/dovecot-mysql.conf
Here's the appropriate section of dovecot-mysql.conf (this section was previously commented out because it was set to "static" in dovecot.conf)
user_query = SELECT CONCAT('/home/vmail/', maildir) AS home, 5000 AS uid, 5000 AS gid FROM mailbox where username = '%u'
My database contains a "maildir" field that has "domain.tld/user@domain.tld/" in it -- all lower case (converted by postfix.admin when a user is created) so I don't have to worry about the conversion to lower case. I just want "USER", "user", "UsEr", etc to all have the same home set for mailbox access.
When I run this query inside a phpmyadmin query box it works fine:
SQL-query: SELECT CONCAT( '/home/vmail/', maildir ) AS home, 5000 AS uid, 5000 AS gid FROM mailbox WHERE username = 'user@domain.tld' LIMIT 0 , 30
It returns this:
home uid gid /home/vmail/domain.tld/user@domain.tld/ 5000 5000
(yes, I have a record called "user@domain.tld" for testing)
I did a direct copy/paste from the dovecot-mysql.conf file with the only change being that I put the actual username in place of the '%u'.
The direct MySQL query is returning the exact same thing that the old "static" setting in dovecot.conf was setting up.
Ideas??
Thanks,
Gerald