summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tls_ocsp.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/tls_ocsp.c b/tls_ocsp.c
index d85d79c..3ba45fc 100644
--- a/tls_ocsp.c
+++ b/tls_ocsp.c
@@ -130,8 +130,8 @@ tls_ocsp_get_certid(X509 *main_cert, STACK_OF(X509) *extra_certs,
 {
 	X509_NAME *issuer_name;
 	X509 *issuer;
-	X509_STORE_CTX storectx;
-	X509_OBJECT tmpobj;
+	X509_STORE_CTX *storectx = NULL;
+	X509_OBJECT *tmpobj = NULL;
 	OCSP_CERTID *cid = NULL;
 	X509_STORE *store;
 
@@ -146,15 +146,24 @@ tls_ocsp_get_certid(X509 *main_cert, STACK_OF(X509) *extra_certs,
 
 	if ((store = SSL_CTX_get_cert_store(ssl_ctx)) == NULL)
 		return NULL;
-	if (X509_STORE_CTX_init(&storectx, store, main_cert, extra_certs) != 1)
+	if ((storectx = X509_STORE_CTX_new()) == NULL)
 		return NULL;
-	if (X509_STORE_get_by_subject(&storectx, X509_LU_X509, issuer_name,
-		&tmpobj) == 1) {
-		cid = OCSP_cert_to_id(NULL, main_cert, tmpobj.data.x509);
-		X509_OBJECT_free_contents(&tmpobj);
+	if (X509_STORE_CTX_init(storectx, store, main_cert, extra_certs) != 1)
+		goto err;
+	if ((tmpobj = X509_OBJECT_new()) == NULL)
+		goto err;
+	if (X509_STORE_get_by_subject(storectx, X509_LU_X509, issuer_name,
+		tmpobj) == 1) {
+		cid = OCSP_cert_to_id(NULL, main_cert, X509_OBJECT_get0_X509(tmpobj));
+		X509_OBJECT_free(tmpobj);
 	}
-	X509_STORE_CTX_cleanup(&storectx);
+	X509_STORE_CTX_free(storectx);
 	return cid;
+
+ err:
+	X509_OBJECT_free(tmpobj);
+	X509_STORE_CTX_free(storectx);
+	return NULL;
 }
 
 struct tls_ocsp *
1'>Free part.parts.ptrJune McEnroe 2020-04-26Rename part->id to part->contentIDJune McEnroe 2020-04-26Iterate through nested multiparts to find content for AtomJune McEnroe 2020-04-26Include Cc address in reply mailtosJune McEnroe 2020-04-26Use %R for RFC numbers in STANDARDS sectionJune McEnroe 2020-04-26Add mailto spec to STANDARDSJune McEnroe 2020-04-26Increase space between nav itemsJune McEnroe 2020-04-26Add mailto address for the archiveJune McEnroe 2020-04-26Put dates on new lines in indexJune McEnroe 2020-04-26Include <> around Message-Id in mailto: URLsJune McEnroe 2020-04-26Add link to index on thread pagesJune McEnroe 2020-04-26Fall back to Content-Type name parameter for attachmentsJune McEnroe 2020-04-26Remove margins in article.message headerJune McEnroe 2020-04-26Generate index.atomJune McEnroe 2020-04-26Generate XHTML content in Atom entriesJune McEnroe 2020-04-25Style index pageJune McEnroe 2020-04-25Render index.htmlJune McEnroe 2020-04-25Wrap <summary> replies count in <data>June McEnroe 2020-04-25Accumulate thread envelopes before concatenationJune McEnroe 2020-04-24Free envelope in concatDataJune McEnroe 2020-04-24Use replyTo address in mailto:June McEnroe 2020-04-23Wrap quoted lines in <q>June McEnroe