Skip to content

Commit

Permalink
fixed regression introduced with 2.4.26: ldif.LDIFParser did not acce…
Browse files Browse the repository at this point in the history
…pt LDIF entry records without trailing empty separator line
  • Loading branch information
stroeder committed Jul 30, 2016
1 parent 7b521f8 commit 57be6e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 4 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changes since 2.4.26:

Lib/
* added 'strf_secs' and 'strp_secs' to ldap.functions.__all__
* fixed regression introduced with 2.4.26:
ldif.LDIFParser did not accept LDIF entry records
without trailing empty separator line

----------------------------------------------------------------
Released 2.4.26 2016-07-24
Expand Down Expand Up @@ -1279,4 +1282,4 @@ Released 2.0.0pre02 2002-02-01
----------------------------------------------------------------
Released 1.10alpha3 2000-09-19

$Id: CHANGES,v 1.390 2016/07/25 08:15:14 stroeder Exp $
$Id: CHANGES,v 1.391 2016/07/30 19:01:59 stroeder Exp $
12 changes: 7 additions & 5 deletions Lib/ldif.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
See http://www.python-ldap.org/ for details.
$Id: ldif.py,v 1.98 2016/07/30 16:18:47 stroeder Exp $
$Id: ldif.py,v 1.99 2016/07/30 19:01:59 stroeder Exp $
Python compability note:
Tested with Python 2.0+, but should work with Python 1.5.2+.
Expand Down Expand Up @@ -297,10 +297,7 @@ def _readline(self):
self.line_counter = self.line_counter + 1
self.byte_counter = self.byte_counter + len(s)
if not s:
raise EOFError('EOF reached after %d lines (%d bytes)' % (
self.line_counter,
self.byte_counter,
))
return None
elif s[-2:]=='\r\n':
return s[:-2]
elif s[-1:]=='\n':
Expand All @@ -312,6 +309,11 @@ def _unfold_lines(self):
"""
Unfold several folded lines with trailing space into one line
"""
if self._last_line is None:
raise EOFError('EOF reached after %d lines (%d bytes)' % (
self.line_counter,
self.byte_counter,
))
unfolded_lines = [ self._last_line ]
next_line = self._readline()
while next_line and next_line[0]==' ':
Expand Down

0 comments on commit 57be6e8

Please sign in to comment.