diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-09-20 21:02:25 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-10-07 20:28:12 +0300 |
commit | 91f2492a786bbe697b1f68e7b15090700a4c08a2 (patch) | |
tree | 82b662d5acee6f210b244b66f88fdb0ceda91a9a /lib/gitlab/ldap | |
parent | 2f11db4b005f67fe7687dd15267062556e8431ad (diff) |
Add `DN#to_s_normalized`
Diffstat (limited to 'lib/gitlab/ldap')
-rw-r--r-- | lib/gitlab/ldap/dn.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/ldap/dn.rb b/lib/gitlab/ldap/dn.rb index 038476b2d2a..0a49d5e4ca8 100644 --- a/lib/gitlab/ldap/dn.rb +++ b/lib/gitlab/ldap/dn.rb @@ -38,7 +38,7 @@ module Gitlab buffer << "," if index % 2 == 0 && index != 0 if index < args.length - 1 || index % 2 == 1 - buffer << Net::LDAP::DN.escape(args[index]) + buffer << self.class.escape(args[index]) else buffer << args[index] end @@ -199,6 +199,12 @@ module Gitlab @dn end + ## + # Return the DN as an escaped and normalized string. + def to_s_normalized + self.class.new(*to_a).to_s + end + # http://tools.ietf.org/html/rfc2253 section 2.4 lists these exceptions # for dn values. All of the following must be escaped in any normal string # using a single backslash ('\') as escape. |