lib/ldap/server/util.rb in ruby-ldapserver-0.5.0 vs lib/ldap/server/util.rb in ruby-ldapserver-0.5.1
- old
+ new
@@ -31,13 +31,13 @@
# characters, given that a multibyte UTF8 character does not contain
# the bytes 00-7F and therefore we cannot confuse '\', '+' etc
def self.split_dn(dn)
# convert \\ to \5c, \+ to \2b etc
- dn2 = dn.gsub(/\\([ #,+"\\<>;])/) { "\\%02x" % $1[0] }
+ dn.gsub!(/\\([ #,+"\\<>;])/) { |match| format "\\%02x", match[1].ord }
# Now we know that \\ and \, do not exist, it's safe to split
- parts = dn2.split(/\s*[,;]\s*/)
+ parts = dn.split(/\s*[,;]\s*/)
parts.collect do |part|
res = {}
# Split each part into attr=val+attr=val