Compare commits

...

No commits in common. 'c9' and 'i8c' have entirely different histories.
c9 ... i8c

2
.gitignore vendored

@ -1 +1 @@
SOURCES/pycurl-7.43.0.6.tar.gz
SOURCES/pycurl-7.43.0.2.tar.gz

@ -1 +1 @@
b9ba304bb5b6f1cb3a90a264aa31d000ff7065a2 SOURCES/pycurl-7.43.0.6.tar.gz
cd617ed4e40a3b8f5ca5bf54aba7f35ed25afa46 SOURCES/pycurl-7.43.0.2.tar.gz

@ -0,0 +1,93 @@
From 047bd00ee53a722eaf46e58e330888cf628d5a7c Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 14 Jan 2019 16:54:19 +0100
Subject: [PATCH 1/2] do_curl_setopt_httppost: do not use uninitialized stack
variable
Detected by Coverity Analysis and Clang:
Error: UNINIT (CWE-457):
pycurl-7.43.0.2/src/easyopt.c:493: var_decl: Declaring variable "res" without initializer.
pycurl-7.43.0.2/src/easyopt.c:524: uninit_use_in_call: Using uninitialized value "(int)res" when calling "create_and_set_error_object".
522| if (PyText_AsStringAndSize(httppost_option, &cstr, &clen, &cencoded_obj)) {
523| PyText_EncodedDecref(nencoded_obj);
524|-> CURLERROR_SET_RETVAL();
525| goto error;
526| }
Error: CLANG_WARNING:
pycurl-7.43.0.2/src/easyopt.c:524:17: warning: 2nd function call argument is an uninitialized value
pycurl-7.43.0.2/src/pycurl.h:286:5: note: expanded from macro 'CURLERROR_SET_RETVAL'
pycurl-7.43.0.2/src/easyopt.c:493:5: note: 'res' declared without an initial value
pycurl-7.43.0.2/src/easyopt.c:496:9: note: Assuming 'len' is not equal to 0
pycurl-7.43.0.2/src/easyopt.c:496:5: note: Taking false branch
pycurl-7.43.0.2/src/easyopt.c:499:17: note: Assuming 'i' is < 'len'
pycurl-7.43.0.2/src/easyopt.c:499:5: note: Loop condition is true. Entering loop body
pycurl-7.43.0.2/src/easyopt.c:505:13: note: Assuming 'which_httppost_item' is not equal to 0
pycurl-7.43.0.2/src/easyopt.c:505:9: note: Taking false branch
pycurl-7.43.0.2/src/easyopt.c:509:13: note: Assuming the condition is false
pycurl-7.43.0.2/src/easyopt.c:509:9: note: Taking false branch
pycurl-7.43.0.2/src/easyopt.c:513:13: note: Assuming the condition is false
pycurl-7.43.0.2/src/easyopt.c:513:9: note: Taking false branch
pycurl-7.43.0.2/src/easyopt.c:519:13: note: Assuming the condition is true
pycurl-7.43.0.2/src/easyopt.c:519:9: note: Taking true branch
pycurl-7.43.0.2/src/easyopt.c:522:17: note: Assuming the condition is true
pycurl-7.43.0.2/src/easyopt.c:522:13: note: Taking true branch
pycurl-7.43.0.2/src/easyopt.c:524:17: note: 2nd function call argument is an uninitialized value
pycurl-7.43.0.2/src/pycurl.h:286:5: note: expanded from macro 'CURLERROR_SET_RETVAL'
---
src/easyopt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/easyopt.c b/src/easyopt.c
index 015fa93..471400c 100644
--- a/src/easyopt.c
+++ b/src/easyopt.c
@@ -521,7 +521,7 @@ do_curl_setopt_httppost(CurlObject *self, int option, int which, PyObject *obj)
if (PyText_AsStringAndSize(httppost_option, &cstr, &clen, &cencoded_obj)) {
PyText_EncodedDecref(nencoded_obj);
- CURLERROR_SET_RETVAL();
+ create_and_set_error_object(self, CURLE_BAD_FUNCTION_ARGUMENT);
goto error;
}
/* INFO: curl_formadd() internally does memdup() the data, so
--
2.17.2
From 6f0f7896412c107c390f4967dcdf94fd14d52047 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 14 Jan 2019 16:57:14 +0100
Subject: [PATCH 2/2] do_multi_add_handle: execute clean-up code before return
Detected by Coverity Analysis:
Error: UNREACHABLE (CWE-561):
pycurl-7.43.0.2/src/multi.c:631: unreachable: This code cannot be reached: "PyDict_DelItem(self->easy_o...".
629| if (res != CURLM_OK) {
630| CURLERROR_MSG("curl_multi_add_handle() failed due to internal errors");
631|-> PyDict_DelItem(self->easy_object_dict, (PyObject *) obj);
632| }
633| obj->multi_stack = self;
---
src/multi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/multi.c b/src/multi.c
index 7ecedbf..3407423 100644
--- a/src/multi.c
+++ b/src/multi.c
@@ -627,8 +627,8 @@ do_multi_add_handle(CurlMultiObject *self, PyObject *args)
assert(obj->multi_stack == NULL);
res = curl_multi_add_handle(self->multi_handle, obj->handle);
if (res != CURLM_OK) {
- CURLERROR_MSG("curl_multi_add_handle() failed due to internal errors");
PyDict_DelItem(self->easy_object_dict, (PyObject *) obj);
+ CURLERROR_MSG("curl_multi_add_handle() failed due to internal errors");
}
obj->multi_stack = self;
Py_INCREF(self);
--
2.17.2

@ -1,56 +0,0 @@
From b3a1ff559c28f71702248cae317fa83baaa086a0 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Mon, 26 Oct 2020 17:26:23 +0100
Subject: [PATCH] src/module.c: make the code compile against python-3.10.0a1
src/module.c:353:25: error: lvalue required as left operand of assignment
353 | Py_TYPE(&Curl_Type) = &PyType_Type;
| ^
src/module.c:354:30: error: lvalue required as left operand of assignment
354 | Py_TYPE(&CurlMulti_Type) = &PyType_Type;
| ^
src/module.c:355:30: error: lvalue required as left operand of assignment
355 | Py_TYPE(&CurlShare_Type) = &PyType_Type;
| ^
Bug: https://bugzilla.redhat.com/1890442
Upstream-commit: c4036bdcb5dd01420a451cf02efac7c3fdf9e41f
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/module.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/module.c b/src/module.c
index 65e8c3a..9204ee0 100644
--- a/src/module.c
+++ b/src/module.c
@@ -11,6 +11,12 @@
#define PYCURL_VERSION_PREFIX "PycURL/" PYCURL_VERSION_STRING
+/* needed for compatibility with python < 3.10, as suggested at:
+ * https://docs.python.org/3.10/whatsnew/3.10.html#id2 */
+#if PY_VERSION_HEX < 0x030900A4
+# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
+#endif
+
PYCURL_INTERNAL char *empty_keywords[] = { NULL };
PYCURL_INTERNAL PyObject *bytesio = NULL;
@@ -412,9 +418,9 @@ initpycurl(void)
p_Curl_Type = &Curl_Type;
p_CurlMulti_Type = &CurlMulti_Type;
p_CurlShare_Type = &CurlShare_Type;
- Py_TYPE(&Curl_Type) = &PyType_Type;
- Py_TYPE(&CurlMulti_Type) = &PyType_Type;
- Py_TYPE(&CurlShare_Type) = &PyType_Type;
+ Py_SET_TYPE(&Curl_Type, &PyType_Type);
+ Py_SET_TYPE(&CurlMulti_Type, &PyType_Type);
+ Py_SET_TYPE(&CurlShare_Type, &PyType_Type);
/* Create the module and add the functions */
if (PyType_Ready(&Curl_Type) < 0)
--
2.25.4

@ -8,77 +8,36 @@ This effectively reverts the following commit:
Bug: https://bugzilla.redhat.com/1446850
---
src/module.c | 62 ----------------------------------------------------
1 file changed, 62 deletions(-)
src/module.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/src/module.c b/src/module.c
index a7108a0..af79875 100644
--- a/src/module.c
+++ b/src/module.c
@@ -328,15 +328,6 @@ initpycurl(void)
@@ -322,7 +322,7 @@ initpycurl(void)
{
PyObject *m, *d;
const curl_version_info_data *vi;
- const char *libcurl_version, *runtime_ssl_lib;
+ const char *libcurl_version;
size_t libcurl_version_len, pycurl_version_len;
PyObject *xio_module = NULL;
PyObject *collections_module = NULL;
PyObject *named_tuple = NULL;
PyObject *arglist = NULL;
-#ifdef HAVE_CURL_GLOBAL_SSLSET
- const curl_ssl_backend **ssllist = NULL;
- CURLsslset sslset;
- int i, runtime_supported_backend_found = 0;
- char backends[200];
- size_t backends_len = 0;
-#else
- const char *runtime_ssl_lib;
-#endif
assert(Curl_Type.tp_weaklistoffset > 0);
assert(CurlMulti_Type.tp_weaklistoffset > 0);
@@ -354,59 +345,6 @@ initpycurl(void)
@@ -345,24 +345,6 @@ initpycurl(void)
goto error;
}
- /* Our compiled crypto locks should correspond to runtime ssl library. */
-#ifdef HAVE_CURL_GLOBAL_SSLSET
- sslset = curl_global_sslset(-1, COMPILE_SSL_LIB, &ssllist);
- if (sslset != CURLSSLSET_OK) {
- if (sslset == CURLSSLSET_NO_BACKENDS) {
- strcpy(backends, "none");
- } else {
- for (i = 0; ssllist[i] != NULL; i++) {
- switch (ssllist[i]->id) {
- case CURLSSLBACKEND_OPENSSL:
- case CURLSSLBACKEND_GNUTLS:
- case CURLSSLBACKEND_NSS:
- case CURLSSLBACKEND_WOLFSSL:
- case CURLSSLBACKEND_MBEDTLS:
- runtime_supported_backend_found = 1;
- break;
- default:
- break;
- }
- if (backends_len < sizeof(backends)) {
- backends_len += snprintf(backends + backends_len, sizeof(backends) - backends_len, "%s%s", (i > 0) ? ", " : "", ssllist[i]->name);
- }
- }
- }
- /* Don't error if both the curl library and pycurl itself is compiled without SSL */
- if (runtime_supported_backend_found || COMPILE_SUPPORTED_SSL_BACKEND_FOUND) {
- PyErr_Format(PyExc_ImportError, "pycurl: libcurl link-time ssl backends (%s) do not include compile-time ssl backend (%s)", backends, COMPILE_SSL_LIB);
- goto error;
- }
- }
-#else
- if (vi->ssl_version == NULL) {
- runtime_ssl_lib = "none/other";
- } else if (!strncmp(vi->ssl_version, "OpenSSL/", 8) || !strncmp(vi->ssl_version, "LibreSSL/", 9) ||
- !strncmp(vi->ssl_version, "BoringSSL", 9)) {
- runtime_ssl_lib = "openssl";
- } else if (!strncmp(vi->ssl_version, "wolfSSL/", 8)) {
- runtime_ssl_lib = "wolfssl";
- } else if (!strncmp(vi->ssl_version, "GnuTLS/", 7)) {
- runtime_ssl_lib = "gnutls";
- } else if (!strncmp(vi->ssl_version, "NSS/", 4)) {
- runtime_ssl_lib = "nss";
- } else if (!strncmp(vi->ssl_version, "mbedTLS/", 8)) {
- runtime_ssl_lib = "mbedtls";
- } else {
- runtime_ssl_lib = "none/other";
- }
@ -86,7 +45,6 @@ index a7108a0..af79875 100644
- PyErr_Format(PyExc_ImportError, "pycurl: libcurl link-time ssl backend (%s) is different from compile-time ssl backend (%s)", runtime_ssl_lib, COMPILE_SSL_LIB);
- goto error;
- }
-#endif
-
/* Initialize the type of the new type objects here; doing it here
* is required for portability to Windows without requiring C++. */

@ -0,0 +1,32 @@
From f5141d34f54ec2ae3309324a99f0f5887f0a8201 Mon Sep 17 00:00:00 2001
From: Dmitriy Taychenachev <dmitriy.taychenachev@skypicker.com>
Date: Tue, 9 Apr 2019 11:23:58 +0200
Subject: [PATCH] decode_string_list: fix populating list of decoded strings
Under Python3 the call curl.getinfo(pycurl.INFO_COOKIELIST) returns
invalid list (for example [<NULL>]), which cases segmentation fault.
The cause is in function decode_string_list() (Python3 only) which
creates new list without populating it with elements. This commit
adds the setting of elements fixing the behaviour.
Upstream-commit: 5df7a0e5bb38a3db5f04721add571cd32c5e3eb8
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
src/easyinfo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/easyinfo.c b/src/easyinfo.c
index b3d731b..3712646 100644
--- a/src/easyinfo.c
+++ b/src/easyinfo.c
@@ -277,6 +277,7 @@ decode_string_list(PyObject *list)
if (decoded_item == NULL) {
goto err;
}
+ PyList_SetItem(decoded_list, i, decoded_item);
}
return decoded_list;
--
2.21.1

@ -5,43 +5,37 @@
%bcond_with python3
%endif
# python2 is not available on Fedora and el8+
%if 0%{?fedora} || 0%{?rhel} > 7
# python2 is not available on RHEL > 7 and not needed on Fedora > 29
%if 0%{?rhel} > 7 || 0%{?fedora} > 29
%bcond_with python2
%else
%bcond_without python2
%endif
# test dependencies are not available on el9+
%if 0%{?fedora}
%bcond_without tests
%else
%bcond_with tests
%endif
%global modname pycurl
Name: python-%{modname}
Version: 7.43.0.6
Release: 8%{?dist}
Version: 7.43.0.2
Release: 4%{?dist}
Summary: A Python interface to libcurl
License: LGPLv2+ or MIT
URL: http://pycurl.sourceforge.net/
# reported as unavailable: https://github.com/pycurl/pycurl/issues/651
# Source0: https://dl.bintray.com/pycurl/pycurl/pycurl-%%{version}.tar.gz
Source0: https://github.com/pycurl/pycurl/archive/REL_7_43_0_6.tar.gz#/pycurl-%{version}.tar.gz
Source0: https://dl.bintray.com/pycurl/pycurl/pycurl-%{version}.tar.gz
# make the code compile against python-3.10.0a1 (#1890442)
Patch1: 0001-python-pycurl-7.43.0.6-python-3.10.patch
# fix programming mistakes detected by static analyzers
# upstream pull request: https://github.com/pycurl/pycurl/pull/550
Patch1: 0001-python-pycurl-7.43.0.2-static-analysis.patch
# drop link-time vs. run-time TLS backend check (#1446850)
Patch2: 0002-python-pycurl-7.43.0-tls-backend.patch
# fix populating list of decoded strings (#1792213)
Patch3: 0003-python-pycurl-7.43.0.2-decode-cookie-info.patch
BuildRequires: gcc
BuildRequires: libcurl-devel
BuildRequires: openssl-devel
BuildRequires: make
BuildRequires: vsftpd
# During its initialization, PycURL checks that the actual libcurl version
@ -64,6 +58,8 @@ of features.
Summary: Python interface to libcurl for Python 2
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires: python2-devel
BuildRequires: python2-bottle
BuildRequires: python2-nose
Requires: libcurl%{?_isa} >= %{libcurl_ver}
Provides: %{modname} = %{version}-%{release}
@ -82,14 +78,8 @@ Python 2 version.
Summary: Python interface to libcurl for Python 3
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python3-devel
%if %{with tests}
BuildRequires: python3-bottle
BuildRequires: python3-nose
%global nosetests nosetests-%{python3_version} -v
%else
%global nosetests true
%endif
BuildRequires: python3-setuptools
Requires: libcurl%{?_isa} >= %{libcurl_ver}
%description -n python3-%{modname}
@ -102,19 +92,11 @@ Python 3 version.
%endif
%prep
%autosetup -n %{modname}-REL_7_43_0_6 -p1
# remove windows-specific build script
rm -f winbuild.py
sed -e 's| winbuild.py||' -i Makefile
%autosetup -n %{modname}-%{version} -p1
# remove binaries packaged by upstream
rm -f tests/fake-curl/libcurl/*.so
# temporarily remove a failing test-case (#1927655)
# upstream issue: https://github.com/curl/curl/issues/6615
rm -f tests/failonerror_test.py
# remove a test-case that relies on sftp://web.sourceforge.net being available
rm -f tests/ssh_key_cb_test.py
@ -129,18 +111,11 @@ sed -e 's/ --show-skipped//' \
-e 's/ --with-flaky//' \
-i tests/run.sh
# use %%{python3} instead of python to invoke tests, to make them work on f34
sed -e 's|python |%{python3} |' -i tests/ext/test-suite.sh
sed -e 's|^#! */usr/bin/env python$|#! /usr/bin/env %{python3}|' \
-i tests/*.py tests/bin/* setup.py
%build
%if %{with python2}
%{python2} setup.py docstrings
%py2_build -- --with-openssl
%endif
%if %{with python3}
%{python3} setup.py docstrings
%py3_build -- --with-openssl
%endif
@ -156,14 +131,15 @@ rm -rf %{buildroot}%{_datadir}/doc/pycurl
%if %{with python3}
%check
# relax crypto policy for the test-suite to make it pass again (#1863711)
export OPENSSL_SYSTEM_CIPHERS_OVERRIDE=XXX
export OPENSSL_CONF=
export PYTHONPATH=%{buildroot}%{python3_sitearch}
export PYCURL_SSL_LIBRARY=openssl
export PYCURL_VSFTPD_PATH=vsftpd
make test PYTHON=%{__python3} NOSETESTS="%{nosetests}" PYFLAKES=true
# relax crypto policy for the test-suite to make it pass again (#1611739)
export OPENSSL_SYSTEM_CIPHERS_OVERRIDE=XXX
export OPENSSL_CONF=
make test PYTHON=%{__python3} NOSETESTS="nosetests-%{python3_version} -v" PYFLAKES=:
rm -fv tests/fake-curl/libcurl/*.so
%endif
@ -186,81 +162,18 @@ rm -fv tests/fake-curl/libcurl/*.so
%endif
%changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 7.43.0.6-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 7.43.0.6-7
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 7.43.0.6-6
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Feb 17 2021 Kamil Dudka <kdudka@redhat.com> - 7.43.0.6-5
- temporarily remove a failing test-case (#1927655)
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.43.0.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jan 18 2021 Kamil Dudka <kdudka@redhat.com> - 7.43.0.6-3
- make build dependencies for upstream tests optional
* Tue Oct 27 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.6-2
- make the code compile against python-3.10.0a1 (#1890442)
* Thu Sep 03 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.6-1
- update to 7.43.0.6
* Tue Aug 04 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.5-6
- relax crypto policy for the test-suite to make it pass again (#1863711)
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.43.0.5-5
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 7.43.0.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 23 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.5-3
- do not use discontinued %%_python_bytecompile_extra macro
- explicitly require python3-setuptools for build
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 7.43.0.5-2
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.5-1
- update to 7.43.0.5
* Wed Jan 15 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.4-1
- update to 7.43.0.4
* Fri Nov 15 2019 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-10
- do not build python2-pycurl on f32+
* Tue Sep 24 2019 Miro Hrončok <mhroncok@redhat.com> - 7.43.0.2-9
- Drop unused Python 2 BuildRequires
* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 7.43.0.2-8
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.43.0.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 03 2019 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-6
- reintroduce the python2-pycurl subpackage on Fedora (#1672061)
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 7.43.0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jul 26 2023 MSVSphere Packaging Team <packager@msvsphere.ru> - 7.43.0.2-4
- Rebuilt for MSVSphere 8.8
* Tue Jan 29 2019 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-4
- fix programming mistakes detected by static analyzers
* Wed Jan 22 2020 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-4
- fix populating list of decoded strings (#1792213)
- fix programming mistakes detected by static analyzers (#1666003)
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 7.43.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Dec 20 2018 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-3
- drop build-time (%%check-only) dependency on pyflakes (#1661168)
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 7.43.0.2-2
- Rebuilt for Python 3.7
* Tue Aug 07 2018 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-2
- relax crypto policy for the test-suite to make it pass again (#1611739)
* Mon Jun 04 2018 Kamil Dudka <kdudka@redhat.com> - 7.43.0.2-1
- update to 7.43.0.2

Loading…
Cancel
Save