Commit f4bca105d16e3bc47c2cd2725c519d2dcd788e70
1 parent
f18f8e67
Exists in
spb-stable
and in
2 other branches
Backport Adapter#ldap_search from EE
Showing
1 changed file
with
17 additions
and
1 deletions
Show diff stats
lib/gitlab/ldap/adapter.rb
... | ... | @@ -64,7 +64,7 @@ module Gitlab |
64 | 64 | end |
65 | 65 | end |
66 | 66 | |
67 | - entries = ldap.search(options).select do |entry| | |
67 | + entries = ldap_search(options).select do |entry| | |
68 | 68 | entry.respond_to? config.uid |
69 | 69 | end |
70 | 70 | |
... | ... | @@ -77,6 +77,22 @@ module Gitlab |
77 | 77 | users(*args).first |
78 | 78 | end |
79 | 79 | |
80 | + def ldap_search(*args) | |
81 | + results = ldap.search(*args) | |
82 | + | |
83 | + if results.nil? | |
84 | + response = ldap.get_operation_result | |
85 | + | |
86 | + unless response.code.zero? | |
87 | + Rails.logger.warn("LDAP search error: #{response.message}") | |
88 | + end | |
89 | + | |
90 | + [] | |
91 | + else | |
92 | + results | |
93 | + end | |
94 | + end | |
95 | + | |
80 | 96 | private |
81 | 97 | |
82 | 98 | def config | ... | ... |