From 7622001802b80766393b82ac5afc922747170e6d Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Tue, 18 Oct 2016 17:09:26 -0500 Subject: [PATCH 1/2] Properly link LDAP users no whether auth hash UID is a UID or DN --- lib/gitlab/o_auth/user.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb index 0a91d3918d553b..3cd4231ed22f49 100644 --- a/lib/gitlab/o_auth/user.rb +++ b/lib/gitlab/o_auth/user.rb @@ -102,6 +102,10 @@ def ldap_person Gitlab::LDAP::Config.providers.each do |provider| adapter = Gitlab::LDAP::Adapter.new(provider) @ldap_person = Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) + # The `uid` might actually be a DN. Try it next. + unless @ldap person + @ldap_person = Gitlab::LDAP::Person.find_by_dn(auth_hash.uid, adapter) + end break if @ldap_person end @ldap_person -- GitLab From 401a0dff8587816c8e9a5978361c17009ce09029 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Wed, 19 Oct 2016 09:16:05 -0500 Subject: [PATCH 2/2] fix syntax --- lib/gitlab/o_auth/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb index 3cd4231ed22f49..e4e6f36613f6cb 100644 --- a/lib/gitlab/o_auth/user.rb +++ b/lib/gitlab/o_auth/user.rb @@ -103,7 +103,7 @@ def ldap_person adapter = Gitlab::LDAP::Adapter.new(provider) @ldap_person = Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) # The `uid` might actually be a DN. Try it next. - unless @ldap person + unless @ldap_person @ldap_person = Gitlab::LDAP::Person.find_by_dn(auth_hash.uid, adapter) end break if @ldap_person -- GitLab