Author Topic: New RC user creation - mail_host check bypass  (Read 3623 times)

Offline martinbocek

  • Jr. Member
  • **
  • Posts: 11
New RC user creation - mail_host check bypass
« on: March 25, 2015, 10:08:45 AM »
Hello,

I am just testing RC 1.1.1 and preparing it to productive use (hundreds of mailboxes). I have met one problem:

Our mail system users are hosted on several imap servers. I have already prepared and tested a plugin which automatically selects correct imap server for current user's domain at 'login' hook.

The problem is that we migrate users(whole domains) between our imap servers on a regular basis (updates, server maintenance etc.). When user logs into RC, RC checks for existing roundcube user in it's database using this sql select:


$sql_result = $dbh->query("SELECT * FROM " . $dbh->table_name('users')
 ." WHERE mail_host = ? AND username = ?", $host, $user);


On our servers - username is unique, we do not need to check the mail_host - there can be only one user (= mail address) in our system.

Because of this, after we migrate user to another imap server than he was using at the moment he logged in to RC for the first time, RC creates a new user on first login after migration with new rc user_id - user is not found in rc db because imap host changed => our user lose all his settings, address book, plugins settings (calendar...)

I think it would be great to make mail_host check in check for existing user optional in main RC config file.

Thank you for your help and reply!



Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
Re: New RC user creation - mail_host check bypass
« Reply #1 on: March 25, 2015, 11:48:02 AM »
The simplest way I can think to work around this would be to run your own query in the authenticate hook to check if the user is set to the correct imap host and if not to update the user record before logging in.

Offline martinbocek

  • Jr. Member
  • **
  • Posts: 11
Re: New RC user creation - mail_host check bypass
« Reply #2 on: March 25, 2015, 12:42:31 PM »
Thanks a lot, that's something that I am working on right now - the idea is simple,  I will include this to my imap select plugin.  I just thout that something like 'make_username_unique' would be great for more users.