[glib-networking/use-add1-chain-cert] openssl: use add1_chain_cert



commit 09e8a810fd32ef7b38c45f2e2cf5e8aa4440f6c5
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date:   Wed Oct 16 10:37:26 2019 +0200

    openssl: use add1_chain_cert
    
    Instead of adding the extra reference on our own use the specific
    method from openssl to do it for us.

 tls/openssl/gtlsserverconnection-openssl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/tls/openssl/gtlsserverconnection-openssl.c b/tls/openssl/gtlsserverconnection-openssl.c
index 77d50ca..c52b855 100644
--- a/tls/openssl/gtlsserverconnection-openssl.c
+++ b/tls/openssl/gtlsserverconnection-openssl.c
@@ -122,11 +122,12 @@ ssl_set_certificate (SSL              *ssl,
     {
       X509 *issuer_x;
 
-      /* Be careful here and duplicate the certificate since the context
+      issuer_x = g_tls_certificate_openssl_get_cert (G_TLS_CERTIFICATE_OPENSSL (issuer));
+
+      /* Be careful here and duplicate the certificate since the ssl object
        * will take the ownership
        */
-      issuer_x = X509_dup (g_tls_certificate_openssl_get_cert (G_TLS_CERTIFICATE_OPENSSL (issuer)));
-      if (SSL_add0_chain_cert (ssl, issuer_x) == 0)
+      if (SSL_add1_chain_cert (ssl, issuer_x) == 0)
         g_warning ("There was a problem adding the chain certificate: %s",
                    ERR_error_string (ERR_get_error (), NULL));
     }


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