Hackviking He killed Chuck Norris, he ruled dancing so he took up a new hobby…

5Mar/132

RoundCube Webmail login case sensitive

I got an issue reported to me that a user of a RoundCube Webmail setup we have had lost all his contacts. I logged in to his account and all the contacts where gone. Checked the database and found that all the contacts where still in the database. After some digging i found that there where 2 accounts in the RoundCube database. One sad User@ourdomain.com the other sad user@ourdomain.com. When I logged on to the User account all the contacts where there! So i realized that RoundCube logon are case sensitive. He will still see his e-mail because the RoundCube doesn't keep track of his password, it only tries to logon to the IMAP server and if logon is successful it creates it own DB-entries to keep track of contacts and other information. The IMAP server however isn't case sensitive and User or user is the same thing for it. But there is an easy way to fix it!

RoundCube Settings

I'm running RoundCube on a IIS server so I go in to the wwwroot and on to the config folder. In the file main.inc.php I look for the line $rcmail_config['login_lc'] = false; and change it like below:

// If users authentication is not case sensitive this must be enabled.
// You can also use it to force conversion of logins to lower case.
// After enabling it all user records need to be updated, e.g. with query:
// UPDATE users SET username = LOWER(username);
$rcmail_config['login_lc'] = true;

Then I do a IIS reset.

Database changes

If the user have all the contacts on the lowercase account your all good. Just delete the User account and it will all be good. But if the contacts where created on the User account like in my case you have to do like this. Delete the lowercase account and then run:

UPDATE users SET username = LOWER(username) WHERE user_id = {id of uppercase account};

If you don't delete the lowercase account first you will get an error like this:

Error Code: 1062. Duplicate entry '{username}' for key 'username'

If the user have spread his contacts over both accounts just change the contact table like this:

UPDATE contacts SET user_id = {id of lowercase account} WHERE user_id = {id of uppercase account};

Then delete the uppercase account and your all good!

Comments (2) Trackbacks (0)
  1. Why where user and User so sad? Did they get some bad news or did someone hurt them? Anyway, I hope they feel more happy now.

    PS: thanks for the solution.

  2. Probably sad because he lost his contacts! 🙂


Leave a Reply

No trackbacks yet.