You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/10/24 04:21:54 UTC
[trafficserver] branch 7.1.x updated: Converts loop and callees in
SSLInitServerContext to std::string
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new 01628ae Converts loop and callees in SSLInitServerContext to std::string
01628ae is described below
commit 01628ae0d4c19421d49fd2c9cd6386fd20ff8eae
Author: Randall Meyer <ra...@yahoo.com>
AuthorDate: Fri Oct 19 16:00:51 2018 -0700
Converts loop and callees in SSLInitServerContext to std::string
(cherry picked from commit acdddc77b65fea602710debc8e25e922dafaada0)
Conflicts:
iocore/net/SSLUtils.cc
---
iocore/net/SSLUtils.cc | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 6bdd05b..f204467 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -1277,12 +1277,12 @@ SSLDefaultServerContext()
}
static bool
-SSLPrivateKeyHandler(SSL_CTX *ctx, const SSLConfigParams *params, const ats_scoped_str &completeServerCertPath, const char *keyPath)
+SSLPrivateKeyHandler(SSL_CTX *ctx, const SSLConfigParams *params, const std::string &completeServerCertPath, const char *keyPath)
{
if (!keyPath) {
// assume private key is contained in cert obtained from multicert file.
- if (!SSL_CTX_use_PrivateKey_file(ctx, completeServerCertPath, SSL_FILETYPE_PEM)) {
- SSLError("failed to load server private key from %s", (const char *)completeServerCertPath);
+ if (!SSL_CTX_use_PrivateKey_file(ctx, completeServerCertPath.c_str(), SSL_FILETYPE_PEM)) {
+ SSLError("failed to load server private key from %s", completeServerCertPath.c_str());
return false;
}
} else if (params->serverKeyPathOnly != nullptr) {
@@ -1487,7 +1487,6 @@ SSL_CTX *
SSLInitServerContext(const SSLConfigParams *params, const ssl_user_config *sslMultCertSettings, Vec<X509 *> &certList)
{
int server_verify_client;
- ats_scoped_str completeServerCertPath;
SSL_CTX *ctx = SSLDefaultServerContext();
EVP_MD_CTX *digest = EVP_MD_CTX_new();
STACK_OF(X509_NAME) *ca_list = nullptr;
@@ -1591,24 +1590,24 @@ SSLInitServerContext(const SSLConfigParams *params, const ssl_user_config *sslMu
}
for (const char *certname = cert_tok.getNext(); certname; certname = cert_tok.getNext()) {
- completeServerCertPath = Layout::relative_to(params->serverCertPathOnly, certname);
- scoped_BIO bio(BIO_new_file(completeServerCertPath, "r"));
+ std::string completeServerCertPath = Layout::relative_to(params->serverCertPathOnly, certname);
+ scoped_BIO bio(BIO_new_file(completeServerCertPath.c_str(), "r"));
X509 *cert = nullptr;
if (bio) {
cert = PEM_read_bio_X509(bio.get(), nullptr, nullptr, nullptr);
}
if (!bio || !cert) {
- SSLError("failed to load certificate chain from %s", (const char *)completeServerCertPath);
+ SSLError("failed to load certificate chain from %s", completeServerCertPath.c_str());
goto fail;
}
if (!SSL_CTX_use_certificate(ctx, cert)) {
- SSLError("Failed to assign cert from %s to SSL_CTX", (const char *)completeServerCertPath);
+ SSLError("Failed to assign cert from %s to SSL_CTX", completeServerCertPath.c_str());
X509_free(cert);
goto fail;
}
certList.push_back(cert);
if (SSLConfigParams::load_ssl_file_cb) {
- SSLConfigParams::load_ssl_file_cb(completeServerCertPath, CONFIG_FLAG_UNVERSIONED);
+ SSLConfigParams::load_ssl_file_cb(completeServerCertPath.c_str(), CONFIG_FLAG_UNVERSIONED);
}
// Load up any additional chain certificates
SSL_CTX_add_extra_chain_cert_bio(ctx, bio);