trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 01/02: TS-5022: nullptr check
Date Thu, 19 Jan 2017 21:13:34 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 200742563ba8328914e3d29e7df6fca41f60bc98
Author: Syeda Persia Aziz <persia.aziz@yahoo.com>
AuthorDate: Wed Jan 18 23:36:35 2017 -0600

    TS-5022: nullptr check
    
    (cherry picked from commit 9b8b25c760067761307e9fdaf677c64900f5ab17)
---
 iocore/net/SSLConfig.cc |  8 +++++---
 proxy/http/HttpSM.cc    | 18 +++++++++++-------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/iocore/net/SSLConfig.cc b/iocore/net/SSLConfig.cc
index 18b9a14..4cd5f76 100644
--- a/iocore/net/SSLConfig.cc
+++ b/iocore/net/SSLConfig.cc
@@ -307,7 +307,9 @@ SSLConfigParams::initialize()
   ssl_client_cert_path     = nullptr;
   REC_ReadConfigStringAlloc(ssl_client_cert_filename, "proxy.config.ssl.client.cert.filename");
   REC_ReadConfigStringAlloc(ssl_client_cert_path, "proxy.config.ssl.client.cert.path");
-  set_paths_helper(ssl_client_cert_path, ssl_client_cert_filename, nullptr, &clientCertPath);
+  if (ssl_client_cert_filename && ssl_client_cert_path) {
+    set_paths_helper(ssl_client_cert_path, ssl_client_cert_filename, nullptr, &clientCertPath);
+  }
   ats_free_null(ssl_client_cert_filename);
   ats_free_null(ssl_client_cert_path);
 
@@ -351,9 +353,9 @@ SSLConfigParams::initialize()
   client_ctx = SSLInitClientContext(this);
   if (!client_ctx) {
     SSLError("Can't initialize the SSL client, HTTPS in remap rules will not function");
+  } else {
+    InsertCTX(this->clientCertPath, this->client_ctx);
   }
-
-  InsertCTX(this->clientCertPath, this->client_ctx);
 }
 
 // getCTX: returns the context attached to the given certificate
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 7d0d067..0c211d5 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4062,13 +4062,17 @@ HttpSM::do_remap_request(bool run_inline)
   }
 
   // check if the overridden client cert filename is already attached to an existing ssl
context
-  ats_scoped_str clientCert(Layout::relative_to(t_state.txn_conf->client_cert_filepath,
t_state.txn_conf->client_cert_filename));
-  auto tCTX = params->getCTX(clientCert);
-
-  if (tCTX == nullptr) {
-    // make new client ctx and add it to the ctx list
-    auto tctx = params->getNewCTX(clientCert);
-    params->InsertCTX(clientCert, tctx);
+  if (t_state.txn_conf->client_cert_filepath && t_state.txn_conf->client_cert_filename)
{
+    ats_scoped_str clientCert(Layout::relative_to(t_state.txn_conf->client_cert_filepath,
t_state.txn_conf->client_cert_filename));
+    if (clientCert != nullptr) {
+      auto tCTX = params->getCTX(clientCert);
+
+      if (tCTX == nullptr) {
+        // make new client ctx and add it to the ctx list
+        auto tctx = params->getNewCTX(clientCert);
+        params->InsertCTX(clientCert, tctx);
+      }
+    }
   }
 
   return;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message