bearded / ruby-ldap

Ruby/LDAP is an extension library for Ruby. It provides the interface to some LDAP libraries (e.g. OpenLDAP, Netscape SDK and Active Directory). The common API for application development is described in RFC1823 and is supported by Ruby/LDAP.
http://rubyforge.org/projects/ruby-ldap/
Other
66 stars 34 forks source link

Bug in ldap/ldif.rb #6

Closed bbense closed 12 years ago

bbense commented 13 years ago

There is a bug in LDAP::LDIF.parse_entry when it is parsing a ldif modify file. If the attribute listed is not lowercase then it fails to parse correctly. example

changetype: modify add: suPriv suPriv: read

Here is a simple one line patch to fix it .


diff -r c779fcb02fdf lib/ldap/ldif.rb
--- a/lib/ldap/ldif.rb  Thu Sep 30 14:21:02 2010 -0700
+++ b/lib/ldap/ldif.rb  Fri Oct 01 10:56:47 2010 -0700
@@ -272,8 +272,9 @@
                         when 'replace' then LDAP_MOD_REPLACE
                       end

+      # In this case val is actually an attribute and should be lowercased. 
            mods[mod_type] ||= {}
-           mods[mod_type][val] ||= []
+           mods[mod_type][val.downcase] ||= []

          when 'control'
ghost commented 12 years ago

Fixed, thank you for reporting!