Compare commits

..

No commits in common. "ae372fc0f7ec1257d5f208437f0e5a11886db99b" and "ad29e9e359e2ed0d4a11f57f435b999a67e59467" have entirely different histories.

5 changed files with 32 additions and 76 deletions

View File

@ -0,0 +1,14 @@
diff --git a/pymongo/pool.py b/pymongo/pool.py
index 859d0e0..f55fd8e 100644
--- a/pymongo/pool.py
+++ b/pymongo/pool.py
@@ -49,8 +49,7 @@ from pymongo.network import (command,
SocketChecker)
from pymongo.read_preferences import ReadPreference
from pymongo.server_type import SERVER_TYPE
-# Always use our backport so we always have support for IP address matching
-from pymongo.ssl_match_hostname import match_hostname, CertificateError
+from ssl import match_hostname, CertificateError
# For SNI support. According to RFC6066, section 3, IPv4 and IPv6 literals are
# not permitted for SNI hostname.

BIN
3.9.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,47 +0,0 @@
From 56b6b6dbc267d365d97c037082369dabf37405d2 Mon Sep 17 00:00:00 2001
From: Shane Harvey <shnhrv@gmail.com>
Date: Wed, 27 Mar 2024 16:51:23 -0700
Subject: [PATCH] PYTHON-4305 Fix bson size check (#1564)
(cherry picked from commit 372b5d68d5a57ccc43b33407cd23f0bc79d99283)
---
bson/_cbsonmodule.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c
index 4e1881a275..da86cd8133 100644
--- a/bson/_cbsonmodule.c
+++ b/bson/_cbsonmodule.c
@@ -2405,6 +2405,7 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
uint32_t c_w_s_size;
uint32_t code_size;
uint32_t scope_size;
+ uint32_t len;
PyObject* code;
PyObject* scope;
PyObject* code_type;
@@ -2424,7 +2425,8 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
memcpy(&code_size, buffer + *position, 4);
code_size = BSON_UINT32_FROM_LE(code_size);
/* code_w_scope length + code length + code + scope length */
- if (!code_size || max < code_size || max < 4 + 4 + code_size + 4) {
+ len = 4 + 4 + code_size + 4;
+ if (!code_size || max < code_size || max < len || len < code_size) {
goto invalid;
}
*position += 4;
@@ -2442,12 +2444,9 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
memcpy(&scope_size, buffer + *position, 4);
scope_size = BSON_UINT32_FROM_LE(scope_size);
- if (scope_size < BSON_MIN_SIZE) {
- Py_DECREF(code);
- goto invalid;
- }
/* code length + code + scope length + scope */
- if ((4 + code_size + 4 + scope_size) != c_w_s_size) {
+ len = 4 + 4 + code_size + scope_size;
+ if (scope_size < BSON_MIN_SIZE || len != c_w_s_size || len < scope_size) {
Py_DECREF(code);
goto invalid;
}

Binary file not shown.

View File

@ -1,15 +1,14 @@
Name: python-pymongo Name: python-pymongo
Version: 4.3.3 Version: 3.9.0
Release: 2 Release: 4
License: Apache License 2.0 License: Apache License 2.0
Summary: PyMongo - the Python driver for MongoDB Summary: PyMongo - the Python driver for MongoDB
URL: https://github.com/mongodb/mongo-python-driver URL: https://github.com/mongodb/mongo-python-driver
Source0: %{pypi_source pymongo} Source0: https://github.com/mongodb/mongo-python-driver/archive/%{version}.tar.gz
# patch source: https://github.com/mongodb/mongo-python-driver/commit/56b6b6dbc267d365d97c037082369dabf37405d2 Patch01: 0001-Use-ssl.match_hostname-from-the-Python-stdlib.patch
Patch01: backport-CVE-2024-21506.patch
BuildRequires: python3-devel python3-setuptools BuildRequires: python3-devel python3-setuptools
BuildRequires: python3-sphinx gcc python3-pip python3-dns BuildRequires: python3-sphinx
%global _description \ %global _description \
The PyMongo distribution contains tools for interacting with \ The PyMongo distribution contains tools for interacting with \
@ -27,7 +26,7 @@ This package is an implementation of the BSON format for Python 3 version.
%package -n python3-pymongo %package -n python3-pymongo
Summary: Python driver for MongoDB Summary: Python driver for MongoDB
Requires: python3-bson = %{version}-%{release} Requires: python3-bson%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-pymongo} %{?python_provide:%python_provide python3-pymongo}
%description -n python3-pymongo %{_description} %description -n python3-pymongo %{_description}
@ -35,7 +34,7 @@ This package is a native Python 3 version driver for MongoDB.
%package -n python3-pymongo-gridfs %package -n python3-pymongo-gridfs
Summary: Python GridFS driver for MongoDB Summary: Python GridFS driver for MongoDB
Requires: python3-pymongo = %{version}-%{release} Requires: python3-pymongo%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python3-pymongo-gridfs} %{?python_provide:%python_provide python3-pymongo-gridfs}
%description -n python3-pymongo-gridfs %{_description} %description -n python3-pymongo-gridfs %{_description}
@ -47,20 +46,25 @@ BuildArch: noarch
Summary: Development documents for python-pymongo Summary: Development documents for python-pymongo
%description help %description help
The PyMongo distribution contains tools for interacting with MongoDB database from Python. %{summary}.
%prep %prep
%autosetup -n pymongo-%{version} -p1 %autosetup -n mongo-python-driver-%{version} -p1
rm pymongo/ssl_match_hostname.py
%build %build
%py3_build %py3_build
pushd doc
make %{?_smp_mflags} html
popd
%install %install
%py3_install %py3_install
chmod 755 %{buildroot}%{python3_sitearch}/bson/*.so install -d -m755 %{buildroot}/%{_pkgdocdir}
chmod 755 %{buildroot}%{python3_sitearch}/pymongo/*.so cp -arf doc/_build/html/* %{buildroot}/%{_pkgdocdir}
%check %check
python3 setup.py test python3 setup.py test
@ -80,28 +84,13 @@ python3 setup.py test
%{python3_sitearch}/gridfs %{python3_sitearch}/gridfs
%files help %files help
%{_docdir}/python3-pymongo %{_pkgdocdir}
%changelog %changelog
* Sun Apr 07 2024 liweigang <liweiganga@uniontech.com> - 4.3.3-2
- Fix CVE-2024-21506
* Thu May 18 2023 chenchen <chen_aka_jan@163.com> - 4.3.3-1
- upgrade to 4.3.3
* Sun Jul 24 2022 liksh <liks11@chinaunicom.com.cn> - 4.0-1
- upgrade to 4.0 for openstack yoga
* Fri Aug 06 2021 OpenStack_SIG <openstack@openeuler.org> - 3.11.3-1
- Update version to 3.11.3
* Mon May 31 2021 huanghaitao <huanghaitao8@huawei.com> - 3.9.0-5
- Completing build dependencies
* Wed Oct 21 2020 chengzihan <chengzihan2@huawei.com> - 3.9.0-4 * Wed Oct 21 2020 chengzihan <chengzihan2@huawei.com> - 3.9.0-4
- Remove subpackage python2-bson, python2-pymongo, python2-pymongo-gridfs - Remove subpackage python2-bson, python2-pymongo, python2-pymongo-gridfs
* Wed Oct 21 2020 liuweibo <liuweibo10@huawei.com> - 3.9.0-3 * Thu 10 2020 liuweibo <liuweibo10@huawei.com> - 3.9.0-3
- Fix Source0 - Fix Source0
* Fri Feb 21 2020 shanshishi <shanshishi@huawei.com> - 3.9.0-2 * Fri Feb 21 2020 shanshishi <shanshishi@huawei.com> - 3.9.0-2