Duplicated id in identities table
Not sure how I wound up with a duplicated id for a user in my identities
table, but thought it best to document it here for others' benefit and to make the code more accepting of it or produce better errors.
I got a report from a developer using my omnibus-gitlab install that he couldn't login with his LDAP account. With a purposefully wrong password he got: Could not authorize you from Ldapmain because "Invalid credentials".
and with the correct password he got: Access denied for your LDAP account.
So, I dug into the DB for this. I found 2 entries for him in the identities table:
gitlabhq_production=# select * from identities where user_id = '20';
id | extern_uid | provider | user_id | created_at | updated_at
----+---------------------------------------------------------------------------+----------+---------+----------------------------+----------------------------
8 | CN=Bob D Developer (bdeveloper),OU=Users,OU=Identity,DC=ad,DC=company,DC=my | ldapmain | 20 | |
41 | CN=Bob Dude Developer (bdeveloper),OU=Users,OU=Identity,DC=ad,DC=company,DC=my | ldapmain | 20 | 2015-04-09 15:39:20.799568 | 2015-04-09 15:39:20.799568
(2 rows)
Not sure why the change to the CN there. But it happened.
It seems to me that the code pulling the user_id
should at least be smart enough to report an error about duplicates if found or, even better, test both rows and just report duplicate returns in the logs.
+++
GitLab 7.9.2 c46d4f54 and 7.9.1