[Dovecot] [ #14832]: Capital letters in POP3 logins

Gerald V. Livingston II gerald.dovecot at sysmatrix.net
Thu Mar 31 04:03:07 EEST 2005


This is going to wrap badly.

On Thu, 31 Mar 2005 01:28:18 +0200 Jakob Hirsch <jh at plonk.de> wrote:

> Gerald V. Livingston II wrote:
> 
> > ERROR : Connection dropped by imap-server.
> 
> what's in the logs?
> Is this with mixed-case usernames or with any username?

With any username. The log was the clue. I started 'tail'ing it while
attempting a login and saw this:

dovecot-auth: MySQL: Error executing query "SELECT home, uid, gid FROM
users WHERE userid = 'user at domain.tld'": Table 'postfix.users' doesn't
exist

Uhhh -- that's not what I had defined in my .conf file.

This was in my dovecot-mysql.conf:

# Examples #   user_query = SELECT home, uid, gid FROM users WHERE userid = '%n' AND domain = '%d' 
#   user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u' 
#   user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u' 
#
#user_query = SELECT home, uid, gid FROM users WHERE userid = '%u'

user_query = SELECT  5000 AS uid, 5000 AS gid, CONCAT('/home/vmail/', domain, '/', username) AS mail FROM mailbox where username = '%u'


It's a bug in Dovecot -- it seems that it ignores commented out lines (#)
after the first call to MySQL. After calling SELECT to get the password
(above the section I quoted) it was then grabbing the commented out line
that was included in the original dovecot-mysql.conf as an example and
trying to use that as the user-info auth mechanism. There was a commented
out SELECT line right above the password auth (the one I added to force
case matching login) and it ignored that one just fine. I could probably
have just moved that auth line up so it was just below the password auth
line but instead I created a separate dovecot-mysql-userinfo.conf file with
that SELECT line way up in the file and all the old examples at the bottom.
I'll clean up all the files to remove all comments after I get it all
running.

How does one report a bug like this?

> Looks ok.
> What is your default_mail_env? Should be "default_mail_env = maildir:%h"
>   (given that you use maildir and have your folders directly in the home
> directory).

default_mail_env = maildir:/home/vmail/%d/%u

There is not really a "home directory". This is all virtual. /etc/passwd
only has system daemons, root, and a single maintainer login for me.

I noticed that none of the default examples have a trailing '/' after the
username. Seems like they should for Maildir.

> > user_query = SELECT CONCAT('/home/vmail/', maildir) AS home, 5000 AS uid, 5000 AS gid FROM mailbox where username = '%u'
> 
> looks also fine.

Changed it to the following to match the "no trailing slash" I was finding
in the default install examples. My 'maildir' field has the trailing slash.

SELECT  5000 AS uid, 5000 AS gid, CONCAT('/home/vmail/', domain, '/', username) AS mail FROM mailbox where username = '%u'

> you could even use

> SELECT LOWER('/home/vmail/%d/%u/') AS home, ...

I was trying to avoid using case modification since I remembered I have all
the required fields -- in lowercase -- in my database

> And btw, just saw that in 1.0-test you can use use modifiers, e.g. %Lu 
> to have a lowercased userid. May be easier to use this with static...

I saw that as well -- but I got it fixed now. ;-)



More information about the dovecot mailing list