40 {
41#ifdef OPENSSL_CERT_OVERRIDE
42
43
44
45 static const char * CA_BUNDLES[] = {
46 "/etc/pki/tls/certs/ca-bundle.crt",
47 "/etc/ssl/certs/ca-certificates.crt",
48 "/usr/share/ssl/certs/ca-bundle.crt",
49 "/usr/local/share/certs/ca-root-nss.crt",
50 "/etc/ssl/cert.pem",
51 "/etc/ssl/ca-bundle.pem"
52 };
53
55
56 const char *const SSL_CA_FILE = X509_get_default_cert_file_env();
57 const char * ssl_cafile =
::getenv(SSL_CA_FILE);
58
59 if (!ssl_cafile)
60 ssl_cafile = X509_get_default_cert_file();
61
62 int replace = true;
63 if (!ssl_cafile || !fs::exists(fs::path(ssl_cafile))) {
64 const char * bundle = nullptr;
65 for (const char * b : CA_BUNDLES) {
66 if (fs::exists(fs::path(b))) {
67 ::setenv(SSL_CA_FILE, bundle = b, replace);
68 break;
69 }
70 }
71
72 if (!bundle)
73 message =
_u8L(
"Could not detect system SSL certificate store. "
74 "PrusaSlicer will be unable to establish secure "
75 "network connections.");
76 else
78 _L(
"PrusaSlicer detected system SSL certificate store in: %1%"),
79 bundle);
80
82 _L(
"To specify the system certificate store manually, please "
83 "set the %1% environment variable to the correct CA bundle "
84 "and restart the application."),
85 SSL_CA_FILE);
86 }
87
88#endif
89
90 if (CURLcode ec = ::curl_global_init(CURL_GLOBAL_DEFAULT)) {
91 message +=
_u8L(
"CURL init has failed. PrusaSlicer will be unable to establish "
92 "network connections. See logs for additional details.");
93
94 BOOST_LOG_TRIVIAL(
error) << ::curl_easy_strerror(ec);
95 }
96 }
#define _u8L(s)
macro used to mark string used at localization, return same string
Definition SLAPrint.cpp:29
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:56
#define _L(s)
Definition I18N.hpp:3
std::string message
Definition Http.cpp:37
static char error[256]
Definition tga.cpp:50