21 DIR *dirp = opendir(directory.c_str());
27 const std::string filename(directory +
"/" + std::string(dirent->d_name));
32 if (!(S_ISREG(stat.st_mode) || S_ISLNK(stat.st_mode)))
50 const char *ca_path_env = getenv(
"X509_CERT_DIR");
51 if (ca_path_env && *ca_path_env)
54 ca_path_ =
"/etc/grid-security/certificates";
55 const char *ca_bundle_env = getenv(
"X509_CERT_BUNDLE");
56 if (ca_bundle_env && *ca_bundle_env)
63 curl_easy_setopt(handle, CURLOPT_CAPATH,
ca_path_.c_str());
64 CURLcode res2 = CURLE_OK;
66 res2 = curl_easy_setopt(handle, CURLOPT_CAINFO,
ca_bundle_.c_str());
68 return (res1 == CURLE_OK) && (res2 == CURLE_OK);
73 std::vector<std::string> candidates;
75 candidates.push_back(
"/etc/ssl/certs");
76 candidates.push_back(
"/etc/pki/tls/certs");
77 candidates.push_back(
"/etc/ssl");
78 candidates.push_back(
"/etc/pki/tls");
79 candidates.push_back(
"/etc/pki/ca-trust/extracted/pem");
80 candidates.push_back(
"/etc/ssl");
82 for (
unsigned i = 0; i < candidates.size(); ++i) {
84 const std::string bundle_candidate = candidates[i] +
"/ca-bundle.crt";
bool HasCertificates(const std::string &directory)
bool SymlinkExists(const std::string &path)
bool FileExists(const std::string &path)
bool ApplySslCertificatePath(CURL *handle) const
bool HasSuffix(const std::string &str, const std::string &suffix, const bool ignore_case)
void UseSystemCertificatePath()