e2cc88f
From 9a5bfbe011be8d79e4bde1f8db2369beb063eb3a Mon Sep 17 00:00:00 2001
a80dc1d
From: Kamil Dudka <kdudka@redhat.com>
a80dc1d
Date: Tue, 2 May 2017 17:19:20 +0200
a80dc1d
Subject: [PATCH] module: drop link-time vs. run-time TLS backend check
a80dc1d
a80dc1d
This effectively reverts the following commit:
a80dc1d
8891398a31119ce7c872509ed60328926c51cdfb
a80dc1d
a80dc1d
Bug: https://bugzilla.redhat.com/1446850
a80dc1d
---
e2cc88f
 src/module.c | 69 ----------------------------------------------------
e2cc88f
 1 file changed, 69 deletions(-)
a80dc1d
a80dc1d
diff --git a/src/module.c b/src/module.c
e2cc88f
index a81391f..b87d1d5 100644
a80dc1d
--- a/src/module.c
a80dc1d
+++ b/src/module.c
e2cc88f
@@ -336,15 +336,6 @@ initpycurl(void)
a80dc1d
     PyObject *collections_module = NULL;
5dbaefc
     PyObject *named_tuple = NULL;
5dbaefc
     PyObject *arglist = NULL;
5dbaefc
-#ifdef HAVE_CURL_GLOBAL_SSLSET
5dbaefc
-    const curl_ssl_backend **ssllist = NULL;
5dbaefc
-    CURLsslset sslset;
5dbaefc
-    int i, runtime_supported_backend_found = 0;
5dbaefc
-    char backends[200];
5dbaefc
-    size_t backends_len = 0;
5dbaefc
-#else
5dbaefc
-    const char *runtime_ssl_lib;
5dbaefc
-#endif
5dbaefc
 
5dbaefc
     assert(Curl_Type.tp_weaklistoffset > 0);
5dbaefc
     assert(CurlMulti_Type.tp_weaklistoffset > 0);
e2cc88f
@@ -362,66 +353,6 @@ initpycurl(void)
a80dc1d
         goto error;
a80dc1d
     }
a80dc1d
 
a80dc1d
-    /* Our compiled crypto locks should correspond to runtime ssl library. */
5dbaefc
-#ifdef HAVE_CURL_GLOBAL_SSLSET
5dbaefc
-    sslset = curl_global_sslset(-1, COMPILE_SSL_LIB, &ssllist);
5dbaefc
-    if (sslset != CURLSSLSET_OK) {
5dbaefc
-        if (sslset == CURLSSLSET_NO_BACKENDS) {
5dbaefc
-            strcpy(backends, "none");
5dbaefc
-        } else {
5dbaefc
-            for (i = 0; ssllist[i] != NULL; i++) {
5dbaefc
-                switch (ssllist[i]->id) {
5dbaefc
-                case CURLSSLBACKEND_OPENSSL:
5dbaefc
-                case CURLSSLBACKEND_GNUTLS:
5dbaefc
-                case CURLSSLBACKEND_NSS:
5dbaefc
-                case CURLSSLBACKEND_WOLFSSL:
5dbaefc
-                case CURLSSLBACKEND_MBEDTLS:
e2cc88f
-#if LIBCURL_VERSION_NUM >= MAKE_LIBCURL_VERSION(7, 64, 1)
e2cc88f
-                case CURLSSLBACKEND_SECURETRANSPORT:
e2cc88f
-#else
e2cc88f
-                case CURLSSLBACKEND_DARWINSSL:
e2cc88f
-#endif
5dbaefc
-                    runtime_supported_backend_found = 1;
5dbaefc
-                    break;
5dbaefc
-                default:
5dbaefc
-                    break;
5dbaefc
-                }
5dbaefc
-                if (backends_len < sizeof(backends)) {
5dbaefc
-                    backends_len += snprintf(backends + backends_len, sizeof(backends) - backends_len, "%s%s", (i > 0) ? ", " : "", ssllist[i]->name);
5dbaefc
-                }
5dbaefc
-            }
5dbaefc
-        }
5dbaefc
-        /* Don't error if both the curl library and pycurl itself is compiled without SSL */
5dbaefc
-        if (runtime_supported_backend_found || COMPILE_SUPPORTED_SSL_BACKEND_FOUND) {
5dbaefc
-            PyErr_Format(PyExc_ImportError, "pycurl: libcurl link-time ssl backends (%s) do not include compile-time ssl backend (%s)", backends, COMPILE_SSL_LIB);
5dbaefc
-            goto error;
5dbaefc
-        }
5dbaefc
-    }
5dbaefc
-#else
a80dc1d
-    if (vi->ssl_version == NULL) {
a80dc1d
-        runtime_ssl_lib = "none/other";
1da12d1
-    } else if (!strncmp(vi->ssl_version, "OpenSSL/", 8) || !strncmp(vi->ssl_version, "LibreSSL/", 9) ||
1da12d1
-               !strncmp(vi->ssl_version, "BoringSSL", 9)) {
a80dc1d
-        runtime_ssl_lib = "openssl";
32500f1
-    } else if (!strncmp(vi->ssl_version, "wolfSSL/", 8)) {
32500f1
-        runtime_ssl_lib = "wolfssl";
a80dc1d
-    } else if (!strncmp(vi->ssl_version, "GnuTLS/", 7)) {
a80dc1d
-        runtime_ssl_lib = "gnutls";
a80dc1d
-    } else if (!strncmp(vi->ssl_version, "NSS/", 4)) {
a80dc1d
-        runtime_ssl_lib = "nss";
32500f1
-    } else if (!strncmp(vi->ssl_version, "mbedTLS/", 8)) {
32500f1
-        runtime_ssl_lib = "mbedtls";
e2cc88f
-    } else if (!strncmp(vi->ssl_version, "Secure Transport", 16)) {
e2cc88f
-        runtime_ssl_lib = "secure-transport";
a80dc1d
-    } else {
a80dc1d
-        runtime_ssl_lib = "none/other";
a80dc1d
-    }
a80dc1d
-    if (strcmp(runtime_ssl_lib, COMPILE_SSL_LIB)) {
a80dc1d
-        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);
a80dc1d
-        goto error;
a80dc1d
-    }
5dbaefc
-#endif
a80dc1d
-
a80dc1d
     /* Initialize the type of the new type objects here; doing it here
a80dc1d
      * is required for portability to Windows without requiring C++. */
a80dc1d
     p_Curl_Type = &Curl_Type;
a80dc1d
-- 
e2cc88f
2.35.1
a80dc1d