summaryrefslogtreecommitdiff
path: root/src/mongo/util/net/ssl_manager_openssl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util/net/ssl_manager_openssl.cpp')
-rw-r--r--src/mongo/util/net/ssl_manager_openssl.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp
index 44521e0115c..1ab1ce6660a 100644
--- a/src/mongo/util/net/ssl_manager_openssl.cpp
+++ b/src/mongo/util/net/ssl_manager_openssl.cpp
@@ -1061,7 +1061,7 @@ bool SSLManagerOpenSSL::_initSynchronousSSLContext(UniqueSSLContext* contextPtr,
unsigned long long SSLManagerOpenSSL::_convertASN1ToMillis(ASN1_TIME* asn1time) {
BIO* outBIO = BIO_new(BIO_s_mem());
int timeError = ASN1_TIME_print(outBIO, asn1time);
- ON_BLOCK_EXIT(BIO_free, outBIO);
+ ON_BLOCK_EXIT([&] { BIO_free(outBIO); });
if (timeError <= 0) {
error() << "ASN1_TIME_print failed or wrote no data.";
@@ -1104,7 +1104,7 @@ bool SSLManagerOpenSSL::_parseAndValidateCertificate(const std::string& keyFile,
return false;
}
- ON_BLOCK_EXIT(BIO_free, inBIO);
+ ON_BLOCK_EXIT([&] { BIO_free(inBIO); });
if (BIO_read_filename(inBIO, keyFile.c_str()) <= 0) {
error() << "cannot read key file when setting subject name: " << keyFile << ' '
<< getSSLErrorMessage(ERR_get_error());
@@ -1118,7 +1118,7 @@ bool SSLManagerOpenSSL::_parseAndValidateCertificate(const std::string& keyFile,
<< getSSLErrorMessage(ERR_get_error());
return false;
}
- ON_BLOCK_EXIT(X509_free, x509);
+ ON_BLOCK_EXIT([&] { X509_free(x509); });
*subjectName = getCertificateSubjectX509Name(x509);
if (serverCertificateExpirationDate != NULL) {
@@ -1159,7 +1159,7 @@ bool SSLManagerOpenSSL::_setupPEM(SSL_CTX* context,
error() << "failed to allocate BIO object: " << getSSLErrorMessage(ERR_get_error());
return false;
}
- const auto bioGuard = MakeGuard([&inBio]() { BIO_free(inBio); });
+ const auto bioGuard = makeGuard([&inBio]() { BIO_free(inBio); });
if (BIO_read_filename(inBio, keyFile.c_str()) <= 0) {
error() << "cannot read PEM key file: " << keyFile << ' '
@@ -1176,7 +1176,7 @@ bool SSLManagerOpenSSL::_setupPEM(SSL_CTX* context,
<< getSSLErrorMessage(ERR_get_error());
return false;
}
- const auto privateKeyGuard = MakeGuard([&privateKey]() { EVP_PKEY_free(privateKey); });
+ const auto privateKeyGuard = makeGuard([&privateKey]() { EVP_PKEY_free(privateKey); });
if (SSL_CTX_use_PrivateKey(context, privateKey) != 1) {
error() << "cannot use PEM key file: " << keyFile << ' '
@@ -1243,7 +1243,7 @@ Status importCertStoreToX509_STORE(const wchar_t* storeName,
return {ErrorCodes::InvalidSSLConfiguration,
str::stream() << "error opening system CA store: " << errnoWithDescription()};
}
- auto systemStoreGuard = MakeGuard([systemStore]() { CertCloseStore(systemStore, 0); });
+ auto systemStoreGuard = makeGuard([systemStore]() { CertCloseStore(systemStore, 0); });
PCCERT_CONTEXT certCtx = NULL;
while ((certCtx = CertEnumCertificatesInStore(systemStore, certCtx)) != NULL) {
@@ -1254,7 +1254,7 @@ Status importCertStoreToX509_STORE(const wchar_t* storeName,
str::stream() << "Error parsing X509 object from Windows certificate store"
<< SSLManagerInterface::getSSLErrorMessage(ERR_get_error())};
}
- const auto x509ObjGuard = MakeGuard([&x509Obj]() { X509_free(x509Obj); });
+ const auto x509ObjGuard = makeGuard([&x509Obj]() { X509_free(x509Obj); });
if (X509_STORE_add_cert(verifyStore, x509Obj) != 1) {
auto status = checkX509_STORE_error();
@@ -1539,7 +1539,7 @@ StatusWith<boost::optional<SSLPeerInfo>> SSLManagerOpenSSL::parseAndValidatePeer
return Status(ErrorCodes::SSLHandshakeFailed, msg);
}
}
- ON_BLOCK_EXIT(X509_free, peerCert);
+ ON_BLOCK_EXIT([&] { X509_free(peerCert); });
long result = SSL_get_verify_result(conn);