diff --git a/.gitignore b/.gitignore index 0cdf864..1a8f214 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ python-ldap-2.3.10.tar.gz /python-ldap-3.0.0b1.tar.gz /python-ldap-3.0.0b2.tar.gz /python-ldap-3.0.0b3.tar.gz +/python-ldap-3.0.0b4.tar.gz diff --git a/0001-Ignore-SASL-methods-in-DSE-test.patch b/0001-Ignore-SASL-methods-in-DSE-test.patch new file mode 100644 index 0000000..3cab360 --- /dev/null +++ b/0001-Ignore-SASL-methods-in-DSE-test.patch @@ -0,0 +1,37 @@ +From e587e8a3020a2967e95278e80a98f4a86b2fd861 Mon Sep 17 00:00:00 2001 +From: Christian Heimes +Date: Wed, 10 Jan 2018 14:53:44 +0100 +Subject: [PATCH] Ignore SASL methods in DSE test + +Closes: https://github.com/python-ldap/python-ldap/issues/160 +Signed-off-by: Christian Heimes +--- + Tests/t_ldapobject.py | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/Tests/t_ldapobject.py b/Tests/t_ldapobject.py +index 27deadc..2c8ce75 100644 +--- a/Tests/t_ldapobject.py ++++ b/Tests/t_ldapobject.py +@@ -520,12 +520,15 @@ class Test00_SimpleLDAPObject(SlapdTestCase): + dse = self._ldap_conn.read_rootdse_s() + self.assertIsInstance(dse, dict) + self.assertEqual(dse[u'supportedLDAPVersion'], [b'3']) ++ keys = set(dse) ++ # SASL info may be missing in restricted build environments ++ keys.discard(u'supportedSASLMechanisms') + self.assertEqual( +- sorted(dse), +- [u'configContext', u'entryDN', u'namingContexts', u'objectClass', ++ keys, ++ {u'configContext', u'entryDN', u'namingContexts', u'objectClass', + u'structuralObjectClass', u'subschemaSubentry', + u'supportedControl', u'supportedExtension', u'supportedFeatures', +- u'supportedLDAPVersion', u'supportedSASLMechanisms'] ++ u'supportedLDAPVersion'} + ) + self.assertEqual( + self._ldap_conn.get_naming_contexts(), +-- +2.14.3 + diff --git a/0001-Use-correct-types-for-BER-en-decode.patch b/0001-Use-correct-types-for-BER-en-decode.patch new file mode 100644 index 0000000..26d547d --- /dev/null +++ b/0001-Use-correct-types-for-BER-en-decode.patch @@ -0,0 +1,53 @@ +From b18b8ad1a5d826a54cff8e3656eb4b8bc9678692 Mon Sep 17 00:00:00 2001 +From: Christian Heimes +Date: Wed, 10 Jan 2018 14:35:24 +0100 +Subject: [PATCH] Use correct types for BER en/decode + +ber_scanf() and ber_printf() "i" format uses ber_int_t. lber_types.h +defines the type as int but Python code assumes the type to be unsigned +long: + +typedef LBER_INT_T ber_int_t; + +The code was working fine on little endian machines but broke on big +endian machines. ber_int_t is now correctly parsed as signed int. + +Signed-off-by: Christian Heimes +--- + Modules/ldapcontrol.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Modules/ldapcontrol.c b/Modules/ldapcontrol.c +index 9522d57..ec50625 100644 +--- a/Modules/ldapcontrol.c ++++ b/Modules/ldapcontrol.c +@@ -242,7 +242,7 @@ encode_rfc2696(PyObject *self, PyObject *args) + BerElement *ber = 0; + struct berval cookie, *ctrl_val; + Py_ssize_t cookie_len; +- unsigned long size; ++ int size = 0; /* ber_int_t is int */ + ber_tag_t tag; + + if (!PyArg_ParseTuple(args, "is#:encode_page_control", &size, +@@ -300,7 +300,7 @@ decode_rfc2696(PyObject *self, PyObject *args) + struct berval ldctl_value; + ber_tag_t tag; + struct berval *cookiep; +- unsigned long count = 0; ++ int count = 0; /* ber_int_t is int */ + Py_ssize_t ldctl_value_len; + + if (!PyArg_ParseTuple(args, "s#:decode_page_control", +@@ -320,7 +320,7 @@ decode_rfc2696(PyObject *self, PyObject *args) + goto endlbl; + } + +- res = Py_BuildValue("(kO&)", count, LDAPberval_to_object, cookiep); ++ res = Py_BuildValue("(iO&)", count, LDAPberval_to_object, cookiep); + ber_bvfree(cookiep); + + endlbl: +-- +2.14.3 + diff --git a/python-ldap.spec b/python-ldap.spec index a741d07..b4c370b 100644 --- a/python-ldap.spec +++ b/python-ldap.spec @@ -1,5 +1,5 @@ ### Abstract ### -%global prerelease b3 +%global prerelease b4 # Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1520990 # openldap does not re-register nss shutdown callbacks after nss_Shutdown is @@ -12,13 +12,17 @@ Name: python-ldap Version: 3.0.0 -Release: 0.3.%{prerelease}%{?dist} +Release: 0.4.%{?prerelease}%{?dist} License: Python Group: System Environment/Libraries Summary: An object-oriented API to access LDAP directory servers URL: http://python-ldap.org/ -Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}%{prerelease}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}%{?prerelease}.tar.gz +# Workaround for https://github.com/python-ldap/python-ldap/issues/160 +Patch0: 0001-Ignore-SASL-methods-in-DSE-test.patch +# https://github.com/python-ldap/python-ldap/issues/161 +Patch1: 0001-Use-correct-types-for-BER-en-decode.patch ### Build Dependencies ### BuildRequires: openldap-devel >= %{openldap_version} @@ -70,7 +74,7 @@ Requires: python3-pyasn1 >= 0.3.7 Requires: python3-pyasn1-modules >= 0.1.5 Requires: python3-setuptools %{?python_provide:%python_provide python3-ldap} -Obsoletes: python3-pyldap +Obsoletes: python3-pyldap < 3 Provides: python3-pyldap = %{version}-%{release} Provides: python3-pyldap%{?_isa} = %{version}-%{release} @@ -79,8 +83,12 @@ Provides: python3-pyldap%{?_isa} = %{version}-%{release} %prep %setup -qc +pushd %{name}-%{version}%{?prerelease} +%patch0 -p1 +%patch1 -p1 +popd -mv %{name}-%{version}%{prerelease} python3 +mv %{name}-%{version}%{?prerelease} python3 cp -a python{3,2} # Fix interpreter @@ -134,7 +142,7 @@ popd %{python_sitearch}/ldif.py* %{python_sitearch}/slapdtest/ %{python_sitearch}/ldap/ -%{python_sitearch}/python_ldap-%{version}%{prerelease}-py2.7.egg-info +%{python_sitearch}/python_ldap-%{version}%{?prerelease}-py2.7.egg-info %files -n python3-ldap %defattr(-,root,root,-) @@ -146,9 +154,12 @@ popd %{python3_sitearch}/__pycache__/* %{python3_sitearch}/slapdtest/ %{python3_sitearch}/ldap/ -%{python3_sitearch}/python_ldap-%{version}%{prerelease}-py%{python3_version}.egg-info +%{python3_sitearch}/python_ldap-%{version}%{?prerelease}-py%{python3_version}.egg-info %changelog +* Wed Jan 10 2018 Christian Heimes - 3.0.0-0.4.b4 +- New upstream release 3.0.0b4 (RHBZ #1496470) + * Wed Dec 20 2017 Christian Heimes - 3.0.0-0.3.b3 - New upstream release 3.0.0b3 (RHBZ #1496470) diff --git a/sources b/sources index 189dc8d..90376ab 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (python-ldap-3.0.0b3.tar.gz) = eb450fe6ed17cfa5be23d1abcdea14ead5263f00c457739166fbf7b6d41ce00c8d0574b56b7ecf838d72c66b313f431bc4e61abbc2d74c7ea6b2eeb1a6465cb1 +SHA512 (python-ldap-3.0.0b4.tar.gz) = 11432638a16b6e7180ed2f8f4d9a5ec65e892e2f0b9fcd0a61ace066372a15ac113c943e3f21f371ea53592f20cec0c91d42370754cba48f16cc5f970e1768f6