[glib-networking/enable-openssl-tests] openssl: simplify client certificate retrieval code
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/enable-openssl-tests] openssl: simplify client certificate retrieval code
- Date: Fri, 17 May 2019 14:14:14 +0000 (UTC)
commit dbf36716090e9e3c1a6cce08c1c86c5b05ce1330
Author: Ignacio Casal Quinteiro <qignacio amazon com>
Date: Fri May 17 16:13:33 2019 +0200
openssl: simplify client certificate retrieval code
tls/openssl/gtlsclientconnection-openssl.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/tls/openssl/gtlsclientconnection-openssl.c b/tls/openssl/gtlsclientconnection-openssl.c
index f05184f..20d08e7 100644
--- a/tls/openssl/gtlsclientconnection-openssl.c
+++ b/tls/openssl/gtlsclientconnection-openssl.c
@@ -342,31 +342,23 @@ retrieve_certificate (SSL *ssl,
GTlsConnectionBase *tls;
GTlsCertificate *cert;
gboolean set_certificate = FALSE;
- GError **certificate_error;
client = SSL_get_ex_data (ssl, data_index);
tls = G_TLS_CONNECTION_BASE (client);
- certificate_error = g_tls_connection_base_get_certificate_error (tls);
-
- g_tls_connection_base_request_certificate (tls, certificate_error);
client->ca_list = SSL_get_client_CA_list (client->ssl);
g_object_notify (G_OBJECT (client), "accepted-cas");
cert = g_tls_connection_get_certificate (G_TLS_CONNECTION (client));
- if (cert != NULL)
- set_certificate = TRUE;
- else
+ if (cert == NULL)
{
- g_clear_error (certificate_error);
- if (g_tls_connection_base_request_certificate (tls, certificate_error))
- {
- cert = g_tls_connection_get_certificate (G_TLS_CONNECTION (client));
- set_certificate = (cert != NULL);
- }
+ g_clear_error (g_tls_connection_base_get_certificate_error (tls));
+
+ if (g_tls_connection_base_request_certificate (tls, g_tls_connection_base_get_certificate_error (tls)))
+ cert = g_tls_connection_get_certificate (G_TLS_CONNECTION (client));
}
- if (set_certificate)
+ if (cert != NULL)
{
EVP_PKEY *key;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]