summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-06-13 14:01:28 -0700
committerMichael Kozono <mkozono@gmail.com>2017-07-26 02:43:40 -0700
commit7f92a36a36ab8183c843982bf91bdabb45861154 (patch)
tree83d7a07f93ff42c370274d898902fca4f56df0b2
parent951bd2a43161206dbafe2a6099098e5fb48a6005 (diff)
downloadgitlab-ce-7f92a36a36ab8183c843982bf91bdabb45861154.tar.gz
Fix plain LDAP (no encryption)
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--lib/gitlab/ldap/config.rb9
-rw-r--r--spec/lib/gitlab/ldap/config_spec.rb2
4 files changed, 10 insertions, 7 deletions
diff --git a/Gemfile b/Gemfile
index 276893d0ff4..7bb912571f4 100644
--- a/Gemfile
+++ b/Gemfile
@@ -61,7 +61,7 @@ gem 'browser', '~> 2.2'
# LDAP Auth
# GitLab fork with several improvements to original library. For full list of changes
# see https://github.com/intridea/omniauth-ldap/compare/master...gitlabhq:master
-gem 'gitlab_omniauth-ldap', '~> 2.0.1', require: 'omniauth-ldap'
+gem 'gitlab_omniauth-ldap', '~> 2.0.2', require: 'omniauth-ldap'
# Git Wiki
# Required manually in config/initializers/gollum.rb to control load order
diff --git a/Gemfile.lock b/Gemfile.lock
index 2b2df1b6bcc..661f0294646 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -288,7 +288,7 @@ GEM
mime-types (>= 1.16, < 3)
posix-spawn (~> 0.3)
gitlab-markup (1.5.1)
- gitlab_omniauth-ldap (2.0.1)
+ gitlab_omniauth-ldap (2.0.2)
net-ldap (~> 0.16)
omniauth (~> 1.3)
pyu-ruby-sasl (>= 0.0.3.3, < 0.1)
@@ -978,7 +978,7 @@ DEPENDENCIES
github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-markup (~> 1.5.1)
- gitlab_omniauth-ldap (~> 2.0.1)
+ gitlab_omniauth-ldap (~> 2.0.2)
gollum-lib (~> 4.2)
gollum-rugged_adapter (~> 0.4.4)
gon (~> 6.1.0)
diff --git a/lib/gitlab/ldap/config.rb b/lib/gitlab/ldap/config.rb
index 163e49ecc1c..8eda3ea03f9 100644
--- a/lib/gitlab/ldap/config.rb
+++ b/lib/gitlab/ldap/config.rb
@@ -169,9 +169,12 @@ module Gitlab
def encryption_options
method = translate_method(options['encryption'])
- options = { method: method }
- options[:tls_options] = tls_options(method) if method
- options
+ return nil unless method
+
+ {
+ method: method,
+ tls_options: tls_options(method)
+ }
end
def translate_method(method_from_config)
diff --git a/spec/lib/gitlab/ldap/config_spec.rb b/spec/lib/gitlab/ldap/config_spec.rb
index e3a9505531d..3a56797d68b 100644
--- a/spec/lib/gitlab/ldap/config_spec.rb
+++ b/spec/lib/gitlab/ldap/config_spec.rb
@@ -32,7 +32,7 @@ describe Gitlab::LDAP::Config, lib: true do
expect(config.adapter_options).to eq(
host: 'ldap.example.com',
port: 386,
- encryption: { method: nil }
+ encryption: nil
)
end