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 18:14:42 UTC
[trafficserver] branch 7.1.x updated: Fixes more leaks when no OCSP
URL is available
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 03adace Fixes more leaks when no OCSP URL is available
03adace is described below
commit 03adace3049a11cf73ea93c858b795e430611100
Author: Randall Meyer <rr...@apple.com>
AuthorDate: Tue Oct 23 08:49:36 2018 -0700
Fixes more leaks when no OCSP URL is available
This is a follow up and more complete version of
19a55a2679dda03f1258e097a82c27c98f00efbc
(cherry picked from commit 82a1368b46701da95524a3b2d71a279753768bbb)
Conflicts:
iocore/net/OCSPStapling.cc
---
iocore/net/OCSPStapling.cc | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc
index ce06b94..874033f 100644
--- a/iocore/net/OCSPStapling.cc
+++ b/iocore/net/OCSPStapling.cc
@@ -116,9 +116,6 @@ stapling_get_issuer(SSL_CTX *ssl_ctx, X509 *x)
}
}
- if (!X509_STORE_CTX_init(inctx, st, nullptr, nullptr)) {
- goto end;
- }
if (X509_STORE_CTX_get1_issuer(&issuer, inctx, x) <= 0) {
issuer = nullptr;
}
@@ -165,12 +162,14 @@ ssl_stapling_init_cert(SSL_CTX *ctx, X509 *cert, const char *certname)
issuer = stapling_get_issuer(ctx, cert);
if (issuer == nullptr) {
Note("cannot get issuer certificate from %s", certname);
- return false;
+ goto err;
}
cinf->cid = OCSP_cert_to_id(nullptr, cert, issuer);
- if (!cinf->cid)
- return false;
+ if (!cinf->cid) {
+ goto err;
+ }
+
X509_digest(cert, EVP_sha1(), cinf->idx, nullptr);
aia = X509_get1_ocsp(cert);
@@ -180,17 +179,28 @@ ssl_stapling_init_cert(SSL_CTX *ctx, X509 *cert, const char *certname)
}
if (!cinf->uri) {
- OCSP_CERTID_free(cinf->cid);
- cinf->cid = nullptr;
-
Note("no OCSP responder URI for %s", certname);
- return false;
+ goto err;
}
SSL_CTX_set_ex_data(ctx, ssl_stapling_index, cinf);
- Note("successfully initialized certinfo for %s into SSL_CTX: %p", certname, ctx);
+ Note("successfully initialized stapling for %s into SSL_CTX: %p", certname, ctx);
return true;
+
+err:
+ if (cinf->uri) {
+ OCSP_CERTID_free(cinf->cid);
+ }
+
+ if (cinf->certname) {
+ ats_free(cinf->certname);
+ }
+
+ if (cinf) {
+ OPENSSL_free(cinf);
+ }
+ return false;
}
static certinfo *