From c74ad898458332c5e2325e5167d635434be490be Mon Sep 17 00:00:00 2001 From: stroeder Date: Wed, 30 Sep 2015 17:17:28 +0000 Subject: [PATCH] LDIFParser now also accepts value-spec without a space after the colon --- CHANGES | 4 +++- Lib/ldif.py | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 586e687..a5540e5 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,8 @@ Released 2.4.22 2015-10-xx Changes since 2.4.21: Lib/ +* LDIFParser now also accepts value-spec without a space + after the colon. ---------------------------------------------------------------- Released 2.4.21 2015-09-25 @@ -1202,4 +1204,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.357 2015/09/30 17:15:53 stroeder Exp $ +$Id: CHANGES,v 1.358 2015/09/30 17:17:28 stroeder Exp $ diff --git a/Lib/ldif.py b/Lib/ldif.py index 36f302d..47df877 100644 --- a/Lib/ldif.py +++ b/Lib/ldif.py @@ -3,7 +3,7 @@ ldif - generate and parse LDIF data (see RFC 2849) See http://www.python-ldap.org/ for details. -$Id: ldif.py,v 1.84 2015/09/30 17:15:53 stroeder Exp $ +$Id: ldif.py,v 1.85 2015/09/30 17:17:28 stroeder Exp $ Python compability note: Tested with Python 2.0+, but should work with Python 1.5.2+. @@ -324,7 +324,7 @@ class LDIFParser: # if needed attribute value is BASE64 decoded value_spec = unfolded_line[colon_pos:colon_pos+2] if value_spec==': ': - attr_value = unfolded_line[colon_pos+2:] + attr_value = unfolded_line[colon_pos+2:].lstrip() elif value_spec=='::': # attribute value needs base64-decoding attr_value = base64.decodestring(unfolded_line[colon_pos+2:]) @@ -336,8 +336,8 @@ class LDIFParser: u = urlparse.urlparse(url) if self._process_url_schemes.has_key(u[0]): attr_value = urllib.urlopen(url).read() - elif value_spec==':\r\n' or value_spec=='\n': - attr_value = '' + else: + attr_value = unfolded_line[colon_pos+1:] return attr_type,attr_value def parse_entry_records(self):