diff -Nru ldif3-3.2.1/CHANGES.rst ldif3-3.2.2/CHANGES.rst --- ldif3-3.2.1/CHANGES.rst 2016-12-27 20:08:36.000000000 +0000 +++ ldif3-3.2.2/CHANGES.rst 2017-02-07 20:04:57.000000000 +0000 @@ -1,8 +1,15 @@ +3.2.2 (2017-02-07) +------------------ + +- Fix detection of unsafe strings in ``unparse`` (See `#7 + `_) + + 3.2.1 (2016-12-27) ------------------ -- Ignore non-unicode characters in "dn" in non-strict mode. (Fixes `#4 - https://github.com/xi/ldif3/issues/6`_) +- Ignore non-unicode characters in "dn" in non-strict mode. (Fixes `#5 + `_) 3.2.0 (2016-06-03) diff -Nru ldif3-3.2.1/debian/changelog ldif3-3.2.2/debian/changelog --- ldif3-3.2.1/debian/changelog 2017-01-11 11:22:41.000000000 +0000 +++ ldif3-3.2.2/debian/changelog 2017-03-17 08:21:09.000000000 +0000 @@ -1,3 +1,13 @@ +ldif3 (3.2.2-1) unstable; urgency=low + + * New upstream release. + * Copy tests.py to builddir so nosetests picks them up during build. + * Add python(3)-mock and python(3)-nose to Build-Depends so tests can + run during build. + * Add patch to skip tests that depend on network. + + -- Michael Fladischer Fri, 17 Mar 2017 09:21:09 +0100 + ldif3 (3.2.1-1) unstable; urgency=low * New upstream release. diff -Nru ldif3-3.2.1/debian/control ldif3-3.2.2/debian/control --- ldif3-3.2.1/debian/control 2017-01-11 11:22:41.000000000 +0000 +++ ldif3-3.2.2/debian/control 2017-03-17 08:21:09.000000000 +0000 @@ -5,8 +5,12 @@ Priority: extra Build-Depends: debhelper (>= 9), python-all, + python-mock, + python-nose, python-setuptools, python3-all, + python3-mock, + python3-nose, python3-setuptools Standards-Version: 3.9.8 Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/ldif3.git diff -Nru ldif3-3.2.1/debian/.git-dpm ldif3-3.2.2/debian/.git-dpm --- ldif3-3.2.1/debian/.git-dpm 2017-01-11 11:22:41.000000000 +0000 +++ ldif3-3.2.2/debian/.git-dpm 2017-03-17 08:21:09.000000000 +0000 @@ -1,8 +1,8 @@ # see git-dpm(1) from git-dpm package -db36ca0ae34ffcc18bcbdaef27ba204170a7796c -db36ca0ae34ffcc18bcbdaef27ba204170a7796c -db36ca0ae34ffcc18bcbdaef27ba204170a7796c -db36ca0ae34ffcc18bcbdaef27ba204170a7796c -ldif3_3.2.1.orig.tar.gz -c8255d478c33e1fc646c12fa1b11b3c42eb37f88 -11833 +3b9c19a6df51cd27f7e3685754ef6c63449bc22f +3b9c19a6df51cd27f7e3685754ef6c63449bc22f +ea59cdd7e254576a52496301d8bfa47166c739b3 +ea59cdd7e254576a52496301d8bfa47166c739b3 +ldif3_3.2.2.orig.tar.gz +a4e383171c64489e32a316b29953e50d46bbd4e7 +11970 diff -Nru ldif3-3.2.1/debian/patches/0001-Skip-tests-that-require-network-connectivity.patch ldif3-3.2.2/debian/patches/0001-Skip-tests-that-require-network-connectivity.patch --- ldif3-3.2.1/debian/patches/0001-Skip-tests-that-require-network-connectivity.patch 1970-01-01 00:00:00.000000000 +0000 +++ ldif3-3.2.2/debian/patches/0001-Skip-tests-that-require-network-connectivity.patch 2017-03-17 08:21:09.000000000 +0000 @@ -0,0 +1,51 @@ +From 3b9c19a6df51cd27f7e3685754ef6c63449bc22f Mon Sep 17 00:00:00 2001 +From: Michael Fladischer +Date: Fri, 17 Mar 2017 09:10:14 +0100 +Subject: Skip tests that require network connectivity. + +By setting the environment NO_NETWOrK to any value some tests get skipped that +would otherwise fail because of the missing network connection. +--- + tests.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/tests.py b/tests.py +index 2647c97..edd5c12 100644 +--- a/tests.py ++++ b/tests.py +@@ -2,6 +2,7 @@ + + from __future__ import unicode_literals + ++import os + import unittest + + try: +@@ -13,6 +14,8 @@ from io import BytesIO + + import ldif3 + ++NO_NETWORK = 'NO_NETWORK' in os.environ ++ + + BYTES = b"""version: 1 + dn: cn=Alice Alison, +@@ -229,15 +232,18 @@ class TestLDIFParser(unittest.TestCase): + self.assertEqual(attr_type, 'foo') + self.assertEqual(attr_value, 'a\nb\nc') + ++ @unittest.skipIf(NO_NETWORK, 'No network connectivity available') + def test_parse_attr_url(self): + self.p._process_url_schemes = [b'https'] + attr_type, attr_value = self.p._parse_attr(b'foo:< ' + URL + b'\n') + self.assertIn(URL_CONTENT, attr_value) + ++ @unittest.skipIf(NO_NETWORK, 'No network connectivity available') + def test_parse_attr_url_all_ignored(self): + attr_type, attr_value = self.p._parse_attr(b'foo:< ' + URL + b'\n') + self.assertEqual(attr_value, '') + ++ @unittest.skipIf(NO_NETWORK, 'No network connectivity available') + def test_parse_attr_url_this_ignored(self): + self.p._process_url_schemes = [b'file'] + attr_type, attr_value = self.p._parse_attr(b'foo:< ' + URL + b'\n') diff -Nru ldif3-3.2.1/debian/patches/series ldif3-3.2.2/debian/patches/series --- ldif3-3.2.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ ldif3-3.2.2/debian/patches/series 2017-03-17 08:21:09.000000000 +0000 @@ -0,0 +1 @@ +0001-Skip-tests-that-require-network-connectivity.patch diff -Nru ldif3-3.2.1/debian/rules ldif3-3.2.2/debian/rules --- ldif3-3.2.1/debian/rules 2017-01-11 11:22:41.000000000 +0000 +++ ldif3-3.2.2/debian/rules 2017-03-17 08:21:09.000000000 +0000 @@ -4,6 +4,9 @@ #export DH_VERBOSE=1 export PYBUILD_NAME=ldif3 +export PYBUILD_BEFORE_TEST=cp {dir}/tests.py {build_dir} +export PYBUILD_AFTER_TEST=rm -f {build_dir}/tests.py +export NO_NETWORK=1 %: dh $@ --with=python2,python3 --buildsystem=pybuild diff -Nru ldif3-3.2.1/ldif3.py ldif3-3.2.2/ldif3.py --- ldif3-3.2.1/ldif3.py 2016-12-27 20:08:36.000000000 +0000 +++ ldif3-3.2.2/ldif3.py 2017-02-07 20:04:57.000000000 +0000 @@ -14,7 +14,7 @@ from urllib.parse import urlparse from urllib.request import urlopen -__version__ = '3.2.1' +__version__ = '3.2.2' __all__ = [ # constants @@ -48,7 +48,9 @@ return rm is not None and rm.group(0) == s -UNSAFE_STRING_PATTERN = '(^[ :<]|[\000\n\r\200-\377])' +UNSAFE_STRING_PATTERN = ( + '(^[^\x01-\x09\x0b-\x0c\x0e-\x1f\x21-\x39\x3b\x3d-\x7f]' + '|[^\x01-\x09\x0b-\x0c\x0e-\x7f])') UNSAFE_STRING_RE = re.compile(UNSAFE_STRING_PATTERN) diff -Nru ldif3-3.2.1/tests.py ldif3-3.2.2/tests.py --- ldif3-3.2.1/tests.py 2016-12-27 20:08:36.000000000 +0000 +++ ldif3-3.2.2/tests.py 2017-02-07 20:04:57.000000000 +0000 @@ -392,3 +392,8 @@ self.w.unparse(u'cn=Björn J Jensen', {u'foo': [u'bar']}) value = self.stream.getvalue() self.assertEqual(value, b'dn:: Y249QmrDtnJuIEogSmVuc2Vu\nfoo: bar\n\n') + + def test_unparse_uniqode(self): + self.w.unparse("o=x", {'test': [u'日本語']}) + value = self.stream.getvalue() + self.assertEqual(value, b'dn: o=x\ntest:: 5pel5pys6Kqe\n\n')