From 1176596ece5907e5828ec495ae385ba7169c8107 Mon Sep 17 00:00:00 2001 From: zhouwenpei Date: Fri, 5 Aug 2022 16:50:52 +0800 Subject: [PATCH] sync 22.03-LTS branch --- Handle-unknown-LDAP-result-code.patch | 42 +++++++++++++++++++++++++++ python-ldap.spec | 24 +++++++++++---- 2 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 Handle-unknown-LDAP-result-code.patch diff --git a/Handle-unknown-LDAP-result-code.patch b/Handle-unknown-LDAP-result-code.patch new file mode 100644 index 0000000..474053f --- /dev/null +++ b/Handle-unknown-LDAP-result-code.patch @@ -0,0 +1,42 @@ +From d2d0d010570160b3daddd754d22f80bf5e435b6f Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 5 May 2022 10:38:57 +0800 +Subject: [PATCH] fix a system error and optimize the checking of LDAP results + +--- + Modules/constants.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/Modules/constants.c b/Modules/constants.c +index 8b902e0..07d6065 100644 +--- a/Modules/constants.c ++++ b/Modules/constants.c +@@ -31,7 +31,8 @@ static PyObject *errobjects[LDAP_ERROR_MAX - LDAP_ERROR_MIN + 1]; + PyObject * + LDAPerr(int errnum) + { +- if (errnum >= LDAP_ERROR_MIN && errnum <= LDAP_ERROR_MAX) { ++ if (errnum >= LDAP_ERROR_MIN && errnum <= LDAP_ERROR_MAX && ++ errobjects[errnum + LDAP_ERROR_OFFSET] != NULL) { + PyErr_SetNone(errobjects[errnum + LDAP_ERROR_OFFSET]); + } + else { +@@ -88,10 +89,13 @@ LDAPraise_for_message(LDAP *l, LDAPMessage *m) + ldap_get_option(l, LDAP_OPT_ERROR_STRING, &error); + } + +- if (errnum >= LDAP_ERROR_MIN && errnum <= LDAP_ERROR_MAX) ++ if (errnum >= LDAP_ERROR_MIN && errnum <= LDAP_ERROR_MAX && ++ errobjects[errnum + LDAP_ERROR_OFFSET] != NULL) { + errobj = errobjects[errnum + LDAP_ERROR_OFFSET]; +- else ++ } ++ else { + errobj = LDAPexception_class; ++ } + + info = PyDict_New(); + if (info == NULL) { +-- +2.23.0 + diff --git a/python-ldap.spec b/python-ldap.spec index c19d95c..b00b33f 100644 --- a/python-ldap.spec +++ b/python-ldap.spec @@ -1,17 +1,17 @@ -%define debug_package %{nil} Name: python-ldap Version: 3.3.1 -Release: 3 +Release: 5 Summary: An object-oriented API to access LDAP directory servers -License: Python +License: Python-2.0 URL: http://python-ldap.org/ Source0: https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz +Patch0: Handle-unknown-LDAP-result-code.patch +Patch1: backport-CVE-2021-46823.patch + BuildRequires: gcc openldap-devel BuildRequires: python3-devel python3-setuptools -Patch0: backport-CVE-2021-46823.patch - %description python-ldap provides an object-oriented API for working with LDAP within\ Python programs. It allows access to LDAP directory servers by wrapping the\ @@ -41,7 +41,7 @@ OpenLDAP 2.x libraries, and contains modules for other LDAP-related tasks\ find . -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python3}|' sed -i 's,-Werror,-Wignore,g' tox.ini %build -%_bindir/python3 setup.py build '--executable=%_bindir/python3 -s' +%py3_build %install %_bindir/python3 setup.py install -O1 --skip-build --root %buildroot @@ -58,6 +58,18 @@ sed -i 's,-Werror,-Wignore,g' tox.ini %doc CHANGES README TODO Demo %changelog +* Fri Aug 05 2022 zhouwenpei - 3.3.1-5 +- Type:bugfix +- Id:NA +- SUG:NA +- DESC:fix a system error and optimize the checking of LDAP results + +* Fri Aug 05 2022 zhouwenpei - 3.3.1-4 +- Type:requirements +- Id:NA +- SUG:NA +- DESC:modify to generate debug rpms + * Tue Jul 26 2022 zhouwenpei - 3.3.1-3 - Type:CVE - Id:CVE-2021-46823 -- Gitee