Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2017-09-21 03:28:57 +0300
committerMichael Kozono <mkozono@gmail.com>2017-10-07 20:28:13 +0300
commit45ab20dca91024602e7c73814e8ff89df2000189 (patch)
tree66b2016cf703177a8e838edcd6f6876bff408413 /lib/gitlab/ldap
parentfe46c11de81e122433b1b275a1078840b289dfcd (diff)
Switch to new DN class
for normalizing and parsing DNs
Diffstat (limited to 'lib/gitlab/ldap')
-rw-r--r--lib/gitlab/ldap/auth_hash.rb2
-rw-r--r--lib/gitlab/ldap/person.rb17
2 files changed, 2 insertions, 17 deletions
diff --git a/lib/gitlab/ldap/auth_hash.rb b/lib/gitlab/ldap/auth_hash.rb
index 3123da17fd9..2ea0a51b18f 100644
--- a/lib/gitlab/ldap/auth_hash.rb
+++ b/lib/gitlab/ldap/auth_hash.rb
@@ -4,7 +4,7 @@ module Gitlab
module LDAP
class AuthHash < Gitlab::OAuth::AuthHash
def uid
- Gitlab::LDAP::Person.normalize_dn(super)
+ Gitlab::LDAP::DN.new(super).to_s_normalized
end
private
diff --git a/lib/gitlab/ldap/person.rb b/lib/gitlab/ldap/person.rb
index 6b1a308d521..44cb6a065c9 100644
--- a/lib/gitlab/ldap/person.rb
+++ b/lib/gitlab/ldap/person.rb
@@ -49,21 +49,6 @@ module Gitlab
uid
end
- # Returns the DN in a normalized form.
- #
- # 1. Excess spaces around attribute names and values are stripped
- # 2. The string is downcased (for case-insensitivity)
- def self.normalize_dn(dn)
- dn.split(/(?<!\\)([,+=])/).map do |part|
- normalize_dn_part(part)
- end.join('')
- rescue StandardError => e
- Rails.logger.info("Returning original DN \"#{dn}\" due to error during normalization attempt: #{e.message}")
- Rails.logger.info(e.backtrace.join("\n"))
-
- dn
- end
-
def initialize(entry, provider)
Rails.logger.debug { "Instantiating #{self.class.name} with LDIF:\n#{entry.to_ldif}" }
@entry = entry
@@ -87,7 +72,7 @@ module Gitlab
end
def dn
- self.class.normalize_dn(entry.dn)
+ DN.new(entry.dn).to_s_normalized
end
private