[gtk-vnc] Initialize gcrypt before any auth method



commit e95446cb23cd17d7cbbb8eb9e20211b14a41a9cf
Author: Daniel P. Berrangé <berrange redhat com>
Date:   Wed Sep 5 16:28:48 2018 +0100

    Initialize gcrypt before any auth method
    
    The gcrypt APIs are now used in multiple auth methods, so we should
    initialize them early, rather than only in the TLS codepath.
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/vncconnection.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index afc1418..f9c510a 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -4426,10 +4426,6 @@ static gboolean vnc_connection_start_tls(VncConnection *conn, int anonTLS)
     int ret;
 
     VNC_DEBUG("Do TLS handshake");
-    if (vnc_connection_tls_initialize() < 0) {
-        vnc_connection_set_error(conn, "%s", "Failed to init TLS");
-        return FALSE;
-    }
     if (priv->tls_session == NULL) {
         if (gnutls_init(&priv->tls_session, GNUTLS_CLIENT) < 0) {
             vnc_connection_set_error(conn, "%s", "Failed to allocate client session");
@@ -4755,6 +4751,11 @@ static gboolean vnc_connection_perform_auth(VncConnection *conn)
     unsigned int nauth, i;
     unsigned int auth[10];
 
+    if (vnc_connection_tls_initialize() < 0) {
+        vnc_connection_set_error(conn, "%s", "Failed to init TLS");
+        return FALSE;
+    }
+
     if (priv->minor <= 6) {
         nauth = 1;
         auth[0] = vnc_connection_read_u32(conn);


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