Author Topic: Multiple user_id for one user  (Read 2038 times)

Offline sben

  • Newbie
  • *
  • Posts: 2
Multiple user_id for one user
« on: February 02, 2013, 04:50:47 AM »
Hi all,

I'm using roundcube on a synology diskstation. Since the last update (I don't have old/new version at hand but can try to find it out if it's important),Roundcube seems to forget my users settings like identities and smtp.

I found out that with every login there is a new user created in the DB (postgresql) with always the same username,but different user_id => the settings associated with the "previous" user_id are still in the DB, but not used for the "new" user:-(   

Any ideas what the reason for this could be? Your help is very much appreciated!

Ben

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,644
    • http://SKaero.com/
Re: Multiple user_id for one user
« Reply #1 on: February 03, 2013, 03:55:18 AM »
I don't know how synology does there RoundCube setup but it shouldn't create a new record if the username and mail host are the same.

Offline sben

  • Newbie
  • *
  • Posts: 2
Re: Multiple user_id for one user
« Reply #2 on: February 04, 2013, 03:23:16 PM »
I looked a bit deeper into this (as far as my knowledge of php allowed) and tracked the problem down to the function query() in rcube_user.php. There is a database query on the tables "users" and "users_type" that obviously doesn't resolve into a valid user object. After that and with the option auto_create_user set somewhere in the config, a new user is created with every login.

This is the code:
Code: [Select]
$query = "SELECT * FROM ".get_table_name('users').
                        " U, users_type UT WHERE U.user_id = UT.user_id AND mail_host = ? AND %s = ? AND account_type = ? AND domain_name = ?";
$sql_result = $dbh->query(sprintf($query, 'username'), $host, $user
                                ,$MailServerConf['account_type'], $MailServerConf['domain_name']);

As soon as I remove the users_type part of the WHERE clause, a user object is returned by the function and the login succeeds as expected.

In the database the field domain_name is empty for all users. The field account_type contains "local" for the "original" user, but is empty for the newly created users. So probably something changed in the $MailServerConf to make account_type be empty now. But there must be something more, because with only the config change, a new user may be created with first login, but afterwards should again be found by the above query!?!?

Unfortunately I'm not able to debug the query to find out what's really going on or to issue the really exact same query on the pgsql command line tool. I think for me (= only twho users local to the synology diskstation) it's ok to simply remove the users_type part of the query, but still it would be better to understand what's wrong...

Thanks
Ben

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,644
    • http://SKaero.com/
Re: Multiple user_id for one user
« Reply #3 on: February 04, 2013, 06:01:32 PM »
Hmm there isn't users_type table in RoundCube, I'm going to guess that its a problem with customizations that Synology have made to RoundCube.