* src/openssl.c (ssl_init): Assign opt.cert_{file, type} from
opt.private_key(_type)
---
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
but
I'm sending this as a seperate patch just in case.
Thanks,
Rohit
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))
--
2.3.0