Skip to content

Commit 041ea93

Browse files
committed
CCDB API: handle gracefully missing X509_CERT_DIR
1 parent fc1d7cb commit 041ea93

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

CCDB/src/CcdbApi.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,11 @@ void CcdbApi::curlSetSSLOptions(CURL* curl_handle)
354354

355355
TJAlienCredentialsObject cmo = mJAlienCredentials->get(cmk);
356356

357-
string CAPath = getenv("X509_CERT_DIR");
358-
curl_easy_setopt(curl_handle, CURLOPT_CAPATH, CAPath.c_str());
357+
char const* CAPath = getenv("X509_CERT_DIR");
358+
if (!CAPath) {
359+
throw std::runtime_error("Please, make sure X509_CERT_DIR is corrctly set");
360+
}
361+
curl_easy_setopt(curl_handle, CURLOPT_CAPATH, CAPath);
359362
curl_easy_setopt(curl_handle, CURLOPT_CAINFO, nullptr);
360363
curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, cmo.certpath.c_str());
361364
curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, cmo.keypath.c_str());

0 commit comments

Comments
 (0)