diff --git a/Dockerfile b/Dockerfile index f3e221f..3169c23 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,8 @@ ADD patches/*.patch /tmp/ RUN apt-get -y update \ && apt-get -y install patch \ && patch /opt/gitlab/embedded/service/gitlab-rails/app/controllers/omniauth_callbacks_controller.rb /tmp/omniauth_callbacks_controller.patch \ - && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/o_auth/user.rb /tmp/user.rb.patch \ - && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/ldap/person.rb /tmp/person.rb.patch \ + && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/auth/o_auth/user.rb /tmp/user.rb.patch \ + && patch /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/auth/ldap/person.rb /tmp/person.rb.patch \ && apt-get -y remove patch \ && apt-get -y clean \ && rm -f /tmp/*.patch diff --git a/patches/person.rb.patch b/patches/person.rb.patch index b7fcd47..eada5be 100644 --- a/patches/person.rb.patch +++ b/patches/person.rb.patch @@ -1,16 +1,14 @@ -diff --git a/person.rb.orig b/person.rb -index 4d6f8ac..1a2cb35 100644 ---- a/person.rb.orig -+++ b/person.rb -@@ -8,6 +8,11 @@ module Gitlab - - attr_accessor :entry, :provider - -+ def self.find_by_uuid(uuid, adapter) -+ uuid = Net::LDAP::Filter.escape(uuid) -+ adapter.user('entryUUID', uuid) -+ end +--- ./lib/gitlab/auth/ldap/person.rb ++++ ./lib/gitlab/auth/ldap/person.rb.patched +@@ -11,6 +11,11 @@ + + attr_accessor :entry, :provider + ++ def self.find_by_uuid(uuid, adapter) ++ uuid = Net::LDAP::Filter.escape(uuid) ++ adapter.user('entryUUID', uuid) ++ end + - def self.find_by_uid(uid, adapter) - uid = Net::LDAP::Filter.escape(uid) - adapter.user(adapter.config.uid, uid) + def self.find_by_uid(uid, adapter) + uid = Net::LDAP::Filter.escape(uid) + adapter.user(adapter.config.uid, uid) diff --git a/patches/user.rb.patch b/patches/user.rb.patch index 95c39bc..2755ea4 100644 --- a/patches/user.rb.patch +++ b/patches/user.rb.patch @@ -1,10 +1,10 @@ ---- ./lib/gitlab/o_auth/user.rb -+++ ./lib/gitlab/o_auth/user-patched.rb -@@ -119,6 +119,7 @@ +--- ./lib/gitlab/auth/o_auth/user.rb ++++ ./lib/gitlab/auth/o_auth/user.rb.patched +@@ -122,6 +122,7 @@ - def find_ldap_person(auth_hash, adapter) - Gitlab::LDAP::Person.find_by_uid(auth_hash.uid, adapter) || -+ Gitlab::LDAP::Person.find_by_uuid(auth_hash.uid, adapter) || - Gitlab::LDAP::Person.find_by_email(auth_hash.uid, adapter) || - Gitlab::LDAP::Person.find_by_dn(auth_hash.uid, adapter) - end + def find_ldap_person(auth_hash, adapter) + Gitlab::Auth::LDAP::Person.find_by_uid(auth_hash.uid, adapter) || ++ Gitlab::Auth::LDAP::Person.find_by_uuid(auth_hash.uid, adapter) || + Gitlab::Auth::LDAP::Person.find_by_email(auth_hash.uid, adapter) || + Gitlab::Auth::LDAP::Person.find_by_dn(auth_hash.uid, adapter) + end