[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [PATCH 2/2] openssl: Read cert from private key file if only

From: Rohit Mathulla
Subject: [Bug-wget] [PATCH 2/2] openssl: Read cert from private key file if only private key file is given
Date: Fri, 24 Apr 2015 15:48:30 +1000

* src/openssl.c (ssl_init): Assign opt.cert_{file, type} from 

While making the previous double free patch, I saw that openssl doesn't have a 
check for the case where --private-key is given but not --certificate. I don't 
know if there is a specific reason for openssl not having it while gnutls does 
I'm sending this as a seperate patch just in case.


 src/openssl.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/openssl.c b/src/openssl.c
index b6cdb8d..3ac0f44 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -296,6 +296,13 @@ ssl_init (void)
       opt.private_key_type = opt.cert_type;
+  /* Use cert from private key file unless otherwise specified. */
+  if (opt.private_key && !opt.cert_file)
+    {
+      opt.cert_file = xstrdup (opt.private_key);
+      opt.cert_type = opt.private_key_type;
+    }
   if (opt.cert_file)
     if (SSL_CTX_use_certificate_file (ssl_ctx, opt.cert_file,
                                       key_type_to_ssl_type (opt.cert_type))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]