gnu: glib: Fix CVE-2021-28153.
[jackhill/guix/guix.git] / gnu / packages / patches / libqalculate-3.8.0-libcurl-ssl-fix.patch
CommitLineData
9b3c231e
VK
1Author: R Veera Kumar 2020 <vkor@vkten.in>
2Desc:
3 1) Fixes download of exchange rates by specifying SSL CA certificates bundle
4 file while using libcurl (Since libcurl in guix is compiled without using
5 a default CA cert bundle file)
6 2) Like above fix for using https site in another case
7
8diff -uNr libqalculate-3.8.0/libqalculate/Calculator-definitions.cc libqalculate-3.8.0.new/libqalculate/Calculator-definitions.cc
9--- libqalculate-3.8.0/libqalculate/Calculator-definitions.cc 2020-02-16 15:08:29.000000000 +0530
10+++ libqalculate-3.8.0.new/libqalculate/Calculator-definitions.cc 2020-04-17 21:27:36.386039369 +0530
11@@ -3610,6 +3610,7 @@
12 curl = curl_easy_init();
13 if(!curl) {return false;}
14 curl_easy_setopt(curl, CURLOPT_URL, getExchangeRatesUrl(1).c_str());
15+ curl_easy_setopt(curl, CURLOPT_CAINFO, getenv("SSL_CERT_FILE"));
16 curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
17 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
18 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sbuffer);
19@@ -3663,6 +3664,7 @@
20
21 sbuffer = "";
22 curl_easy_setopt(curl, CURLOPT_URL, getExchangeRatesUrl(2).c_str());
23+ curl_easy_setopt(curl, CURLOPT_CAINFO, getenv("SSL_CERT_FILE"));
24 curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
25 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
26 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sbuffer);
27@@ -3687,6 +3689,7 @@
28
29 sbuffer = "";
30 curl_easy_setopt(curl, CURLOPT_URL, getExchangeRatesUrl(3).c_str());
31+ curl_easy_setopt(curl, CURLOPT_CAINFO, getenv("SSL_CERT_FILE"));
32 curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
33 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
34 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sbuffer);
35@@ -3710,6 +3713,7 @@
36
37 sbuffer = "";
38 curl_easy_setopt(curl, CURLOPT_URL, getExchangeRatesUrl(4).c_str());
39+ curl_easy_setopt(curl, CURLOPT_CAINFO, getenv("SSL_CERT_FILE"));
40 curl_easy_setopt(curl, CURLOPT_TIMEOUT, (timeout > 4 && n <= 0) ? 4 : timeout);
41 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
42 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sbuffer);
43diff -uNr libqalculate-3.8.0/libqalculate/util.cc libqalculate-3.8.0.new/libqalculate/util.cc
44--- libqalculate-3.8.0/libqalculate/util.cc 2019-12-14 22:56:45.000000000 +0530
45+++ libqalculate-3.8.0.new/libqalculate/util.cc 2020-04-17 21:12:17.259674572 +0530
46@@ -769,6 +769,7 @@
47 curl = curl_easy_init();
48 if(!curl) {return -1;}
49 curl_easy_setopt(curl, CURLOPT_URL, "https://qalculate.github.io/CURRENT_VERSIONS");
50+ curl_easy_setopt(curl, CURLOPT_CAINFO, getenv("SSL_CERT_FILE"));
51 curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
52 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
53 curl_easy_setopt(curl, CURLOPT_WRITEDATA, &sbuffer);