{"id":1004,"date":"2012-05-10T12:34:01","date_gmt":"2012-05-10T12:34:01","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=1004"},"modified":"2012-05-10T12:49:05","modified_gmt":"2012-05-10T12:49:05","slug":"roundcube-dovecot-imap-and-case-sensitive-user-names","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=1004","title":{"rendered":"Roundcube, Dovecot IMAP and case sensitive user names"},"content":{"rendered":"<h2><span class=\"Apple-style-span\" style=\"font-size: 13px; font-weight: normal;\">Do your mail users like it to use mixed upper\/lower case in user names? So the problem described below may hit you.<\/span><\/h2>\n<div>\n<div>\n<p>Your mail user is known to the system as\u00a0<em>user.name@domain.tld<\/em>. The user itself knows himself as<em>User Name<\/em>\u00a0so he naturally (it seems) uses\u00a0<em>User.Name@domain.tld<\/em>\u00a0when logging in to the\u00a0<a href=\"http:\/\/roundcube.net\/\">Roundcube<\/a>\u00a0webmail page. Roundcube does not care much and saves\u00a0<em>User.Name@domain.tld<\/em>\u00a0to it&#8217;s internal data base.<\/p>\n<p>It tries to connect to the Dovecot IMAP server and gets a\u00a0<em>a001 NO Authentication failed.<\/em>\u00a0back. Dovecot indeed cares about the case. When trying to use the lower case variant<em>user.name@domain.tld<\/em>\u00a0Roundcube still seems to use the former mixed case variant it already saved for connecting to the IMAP server.<\/p>\n<p>To make it easy for your users just configure Dovecot to convert user names to lower case before looking it up in the system. Set this variable in\u00a0<em>\/etc\/dovecot\/dovecot.conf<\/em>:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">auth_username_format =\u00a0%Lu<\/div><\/div>\n<p>And restart Dovecot.<\/p>\n<p>Note :<\/p>\n<p>I stumbled upon the same problem in our rc 0.5 installation. Unless<br \/>\nyou have some weird imap server that requires case sensitive usernames<br \/>\nyou *should* set $rcmail_config[&#8216;<strong>login_lc<\/strong>&#8216;] to &#8220;true&#8221;. If you don&#8217;t<br \/>\nthen some of your users will use an upper\/lower case combination for<br \/>\ntheir username the first time they try to login and then they would<br \/>\nhave to stick with it or else will fail to login successfully with an<br \/>\nerror message like:<\/p>\n<p>MDB2 Error: constraint violation (-3): _doQuery: [Error message: Could<br \/>\nnot execute statement]<br \/>\n[Last executed query: EXECUTE<br \/>\nmdb2_statement_mysql_59ee766a0fe6d6645f1d52ec743dc1adb66c4b2e3 USING<br \/>\n@0, @1, @2, @3]<br \/>\n[Native code: 1062]<br \/>\n[Native message: Duplicate entry &#8216;user10-mail.server.tld&#8217; for key &#8216;username&#8217;]<\/p>\n<p>After setting\u00a0<strong>login_lc<\/strong>\u00a0to true you would probably have to clean up the<br \/>\nusers table and make sure that all username entries are in lower case.<\/p>\n<p>RC developers, consider setting the default value of\u00a0<strong>login_lc<\/strong>\u00a0to true<br \/>\nor at least add it to the installer page with a proper notice.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Do your mail users like it to use mixed upper\/lower case in user names? So the problem described below may hit you. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1004","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1004"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1004\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}