Commit f1e3312e authored by Neel Goyal's avatar Neel Goyal Committed by Facebook Github Bot

Clear errors when reading pems

Summary: Clear/read OpenSSL errors after certain ops.

Reviewed By: mingtaoy

Differential Revision: D8277088

fbshipit-source-id: aa436657c3bca3a081cd56858e09da57a03cda05
parent da72e6e9
...@@ -330,7 +330,7 @@ void SSLContext::loadTrustedCertificates(X509_STORE* store) { ...@@ -330,7 +330,7 @@ void SSLContext::loadTrustedCertificates(X509_STORE* store) {
void SSLContext::loadClientCAList(const char* path) { void SSLContext::loadClientCAList(const char* path) {
auto clientCAs = SSL_load_client_CA_file(path); auto clientCAs = SSL_load_client_CA_file(path);
if (clientCAs == nullptr) { if (clientCAs == nullptr) {
LOG(ERROR) << "Unable to load ca file: " << path; LOG(ERROR) << "Unable to load ca file: " << path << " " << getErrors();
return; return;
} }
SSL_CTX_set_client_CA_list(ctx_, clientCAs); SSL_CTX_set_client_CA_list(ctx_, clientCAs);
......
...@@ -209,6 +209,7 @@ std::vector<X509UniquePtr> OpenSSLCertUtils::readCertsFromBuffer( ...@@ -209,6 +209,7 @@ std::vector<X509UniquePtr> OpenSSLCertUtils::readCertsFromBuffer(
while (true) { while (true) {
X509UniquePtr x509(PEM_read_bio_X509(b.get(), nullptr, nullptr, nullptr)); X509UniquePtr x509(PEM_read_bio_X509(b.get(), nullptr, nullptr, nullptr));
if (!x509) { if (!x509) {
ERR_clear_error();
break; break;
} }
certs.push_back(std::move(x509)); certs.push_back(std::move(x509));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment