1 Make libcurl respect the SSL_CERT_{DIR,FILE} variables by default. The variables
2 are fetched during initialization to preserve thread-safety (curl_global_init(3)
3 must be called when no other threads exist).
5 This fixes network functionality in rust:cargo, and probably removes the need
6 for other future workarounds.
7 ===================================================================
8 --- curl-7.66.0.orig/lib/easy.c 2020-01-02 15:43:11.883921171 +0100
9 +++ curl-7.66.0/lib/easy.c 2020-01-02 16:18:54.691882797 +0100
11 # pragma warning(default:4232) /* MSVC extension, dllimport identity */
14 +char * Curl_ssl_cert_dir = NULL;
15 +char * Curl_ssl_cert_file = NULL;
18 * curl_global_init() globally initializes curl given a bitwise set of the
19 * different features of what to initialize.
24 + Curl_ssl_cert_dir = curl_getenv("SSL_CERT_DIR");
25 + Curl_ssl_cert_file = curl_getenv("SSL_CERT_FILE");
27 if(!Curl_ssl_init()) {
28 DEBUGF(fprintf(stderr, "Error: Curl_ssl_init failed\n"));
29 return CURLE_FAILED_INIT;
32 Curl_resolver_global_cleanup();
34 + free(Curl_ssl_cert_dir);
35 + free(Curl_ssl_cert_file);
38 Curl_win32_cleanup(init_flags);
40 diff -ur curl-7.66.0.orig/lib/url.c curl-7.66.0/lib/url.c
41 --- curl-7.66.0.orig/lib/url.c 2020-01-02 15:43:11.883921171 +0100
42 +++ curl-7.66.0/lib/url.c 2020-01-02 16:21:11.563880346 +0100
47 + extern char * Curl_ssl_cert_dir;
48 + extern char * Curl_ssl_cert_file;
49 + if(Curl_ssl_cert_dir) {
50 + if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_ORIG], Curl_ssl_cert_dir))
52 + if(result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], Curl_ssl_cert_dir))
56 + if(Curl_ssl_cert_file) {
57 + if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_ORIG], Curl_ssl_cert_file))
59 + if(result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY], Curl_ssl_cert_file))
64 set->wildcard_enabled = FALSE;