File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -184,9 +184,20 @@ def to_ldif
184184 # Eventually, we should have a class method that parses large LDIF
185185 # streams into individual LDIF blocks (delimited by blank lines)
186186 # and passes them here.
187+ #
188+ # There is one oddity, noticed by Matthias Tarasiewicz: as originally
189+ # written, this code would return an Entry object in which the DN
190+ # attribute consisted of a two-element array, and the first element was
191+ # nil. That's because Entry#initialize doesn't like to create an object
192+ # without a DN attribute so it adds one: nil. The workaround here is
193+ # to wipe out the nil DN after creating the Entry object, and trust the
194+ # LDIF string to fill it in. If it doesn't we return a nil at the end.
195+ # (30Sep06, FCianfrocca)
196+ #
187197 class << self
188198 def from_single_ldif_string ldif
189199 entry = Entry . new
200+ entry [ :dn ] = [ ]
190201 ldif . split ( /\r ?\n /m ) . each { |line |
191202 break if line . length == 0
192203 if line =~ /\A ([\w ]+):(:?)[\s ]*/
You can’t perform that action at this time.
0 commit comments