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:
$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