[Dovecot] Make user name CaSe Insensitive
Hi,
I have mail box info@mydomain.com stored in MySQL db.
But dovecot is allowing me to login as both
INFO@MYDOMAIN.COM info@mydomain.com
Shows two mail boxes. The small letter account is the one mail server really deliver all mails.
Is there any way i can specify all login names are small letters, so that user always access real mail box ?
Regards,
Yujin
On 7.8.2006, at 23.11, FlashWebHost.com wrote:
I have mail box info@mydomain.com stored in MySQL db.
But dovecot is allowing me to login as both
INFO@MYDOMAIN.COM info@mydomain.com
Shows two mail boxes. The small letter account is the one mail server really deliver all mails.
Is there any way i can specify all login names are small letters, so that user always access real mail box ?
One way would be to allow both, but change the username to the
correct case:
password_query = select user, password, ..
ie. make it return the "user" field as in the database.
Another way would be to change the SQL query to do case sensitive
comparision instead of .. where user = '%u'. I don't remember how
exactly this was done with MySQL, see its documentation.
password_query = select user, password, .. ie. make it return the "user" field as in the database.
I have tried this.
password_query = SELECT username as user, password FROM mailbox WHERE username = '%u' AND active=1
But it do not make the user name case insensitive. I can login with CAPITAL and small letter user names and getting two different inboxes.
Another way would be to change the SQL query to do case sensitive comparision instead of .. where user = '%u'. I don't remember how exactly this was done with MySQL, see its documentation.
This can be done with
password_query = SELECT password FROM mailbox WHERE username = BINARY '%u' AND active=1
But this will stop login case senstive (do not allow the capital user, in my case as mysql have lower case user, this is what i have done now).
This will almost solve my problem. But it will be great if i can allow case insensitive login to mail box.
Regards,
Yujin
On 7.8.2006, at 23.45, FlashWebHost.com wrote:
password_query = select user, password, .. ie. make it return the "user" field as in the database.
I have tried this.
password_query = SELECT username as user, password FROM mailbox WHERE username = '%u' AND active=1
But it do not make the user name case insensitive. I can login with CAPITAL and small letter user names and getting two different inboxes.
Well, that should have worked. What Dovecot version are you using?
Probably won't work with 0.99, but should work with 1.0rcs. Or what
do you use as user_query? Maybe try enabling auth_debug and see what
it shows.
hi, i use dovecot-1.0rc6, and can not make user name case insensitive when i login 'JOhwn' and 'johnw', dovecot will use two mail box
dovecot-sql.conf: driver = mysql connect = host=/mysql.sock dbname=mail user=UUUUUUUUUU password=XXXXXXXXXXX default_pass_scheme = PLAIN-MD5 password_query = SELECT user as user, password FROM vuser WHERE user = '%n' AND %Ls = '1' AND password != 'null'
mail log: auth(default): client in: AUTH 1 PLAIN service=IMAP secured lip=127.0.0.1 rip=127.0.0.1 resp=XXXXXXXXXX Aug 17 17:46:03 tiny dovecot: auth-worker(default): sql(JOhnw,127.0.0.1): query: SELECT user as user, password FROM vuser WHERE user = 'JOhnw' AND imap = '1' AND password != 'null' Aug 17 17:46:03 tiny dovecot: auth-worker(default): auth(JOhnw,127.0.0.1): username changed JOhnw -> johnw Aug 17 17:46:03 tiny dovecot: auth(default): client out: OK 1 user=JOhnw Aug 17 17:46:03 tiny dovecot: auth(default): master in: REQUEST 798 32749 1 Aug 17 17:46:03 tiny dovecot: auth(default): master out: USER 798 JOhnw uid=32765 gid=32765 home=/var/spool/postfix/var/./mail Aug 17 17:46:03 tiny dovecot: imap-login: Login: user=<JOhnw>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured Aug 17 17:46:05 tiny dovecot: IMAP(JOhnw): Disconnected: Logged out
mysql-shell: mysql> use mail; Database changed mysql> select user as user, password from vuser where user = 'JOHnw' and imap = '1' and password != 'null'; +-------+----------------------------------+ | user | password | +-------+----------------------------------+ | johnw | XXXXXX this is md5 password XXXX | +-------+----------------------------------+ 1 row in set (0.02 sec)
Timo Sirainen wrote:
On 7.8.2006, at 23.45, FlashWebHost.com wrote:
password_query = select user, password, .. ie. make it return the "user" field as in the database.
I have tried this.
password_query = SELECT username as user, password FROM mailbox WHERE username = '%u' AND active=1
But it do not make the user name case insensitive. I can login with CAPITAL and small letter user names and getting two different inboxes.
Well, that should have worked. What Dovecot version are you using? Probably won't work with 0.99, but should work with 1.0rcs. Or what do you use as user_query? Maybe try enabling auth_debug and see what it shows.
On Thu, 2006-08-17 at 18:08 +0800, John Wong wrote:
hi, i use dovecot-1.0rc6, and can not make user name case insensitive when i login 'JOhwn' and 'johnw', dovecot will use two mail box
Sorry for a late reply. This is now anyway fixed in CVS:
http://dovecot.org/list/dovecot-cvs/2006-October/006582.html
participants (4)
-
FlashWebHost.com
-
Jakob Hirsch
-
John Wong
-
Timo Sirainen