--- Gemfile.orig	2014-05-19 13:15:25.830000000 +0200
+++ Gemfile	2014-05-19 13:16:01.020000000 +0200
@@ -36,7 +36,8 @@
 gem 'gitlab-grack', '~> 2.0.0.pre', require: 'grack'
 
 # LDAP Auth
-gem 'gitlab_omniauth-ldap', '1.0.4', require: "omniauth-ldap"
+# Patched for attributes mapping customization
+gem 'gitlab_omniauth-ldap', '1.0.4', require: 'omniauth-ldap', git: 'https://github.com/jirutka/omniauth-ldap.git', ref: 'b55852bfc9b46ecf790a2c5526386702350eab89'
 
 # Git Wiki
 gem 'gollum-lib', '~> 3.0.0'
--- Gemfile.lock.orig	2014-05-19 13:16:34.160000000 +0200
+++ Gemfile.lock	2014-05-19 13:17:44.500000000 +0200
@@ -5,6 +5,17 @@
   specs:
     charlock_holmes (0.6.9.4)
 
+ GIT
+  remote: https://github.com/jirutka/omniauth-ldap.git
+  revision: b55852bfc9b46ecf790a2c5526386702350eab89
+  ref: b55852bfc9b46ecf790a2c5526386702350eab89
+  specs:
+    gitlab_omniauth-ldap (1.0.4)
+      net-ldap (~> 0.3.1)
+      omniauth (~> 1.0)
+      pyu-ruby-sasl (~> 0.0.3.1)
+      rubyntlm (~> 0.1.1)
+
 GEM
   remote: https://rubygems.org/
   specs:
@@ -186,11 +197,6 @@
       gitlab-linguist (~> 3.0)
       rugged (~> 0.19.0)
     gitlab_meta (6.0)
-    gitlab_omniauth-ldap (1.0.4)
-      net-ldap (~> 0.3.1)
-      omniauth (~> 1.0)
-      pyu-ruby-sasl (~> 0.0.3.1)
-      rubyntlm (~> 0.1.1)
     gollum-lib (3.0.0)
       github-markup (~> 1.1.0)
       gitlab-grit (~> 2.6.5)
@@ -593,7 +599,7 @@
   gitlab_emoji (~> 0.0.1.1)
   gitlab_git (~> 5.8)
   gitlab_meta (= 6.0)
-  gitlab_omniauth-ldap (= 1.0.4)
+  gitlab_omniauth-ldap (= 1.0.4)!
   gollum-lib (~> 3.0.0)
   gon (~> 5.0.0)
   grape (~> 0.6.1)
--- config/gitlab.yml.example.orig	2014-05-19 13:18:03.400000000 +0200
+++ config/gitlab.yml.example	2014-05-19 13:18:45.740000000 +0200
@@ -135,6 +135,10 @@
     method: 'ssl' # "tls" or "ssl" or "plain"
     bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
     password: '_the_password_of_the_bind_user'
+    mapping:
+      username: 'uid'   
+      name: 'cn'
+      email: 'mail'
     # If allow_username_or_email_login is enabled, GitLab will ignore everything
     # after the first '@' in the LDAP username submitted by the user on login.
     #
--- config/initializers/devise.rb.orig	2014-05-19 13:19:23.120000000 +0200
+++ config/initializers/devise.rb	2014-05-19 13:19:43.170000000 +0200
@@ -223,6 +223,7 @@
       method:   Gitlab.config.ldap['method'],
       bind_dn:  Gitlab.config.ldap['bind_dn'],
       password: Gitlab.config.ldap['password'],
+      mapping:  Gitlab.config.ldap['mapping'],
       name_proc: email_stripping_proc
   end