Blame SOURCES/0005-conn-Report-error-if-vnc_connection_perform_auth_vnc.patch

d1efb8
From bfc434015456687388370ccfc0fc92fd54c58b4b Mon Sep 17 00:00:00 2001
d1efb8
From: Christophe Fergeau <cfergeau@redhat.com>
d1efb8
Date: Wed, 9 Jan 2019 14:01:24 +0100
d1efb8
Subject: [PATCH] conn: Report error if vnc_connection_perform_auth_vnc fails
d1efb8
d1efb8
At the moment, when the various crypto operations that
d1efb8
vnc_connection_perform_auth_vnc performs fail, no error is reported to
d1efb8
the client application. This commit adds the emission of a vnc-error
d1efb8
signal when this happens. This is not reported as an auth failure as
d1efb8
these errors are not something which is recoverable, they indicate
d1efb8
system failures.
d1efb8
d1efb8
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
d1efb8
(cherry picked from commit fa21beab5b44354c890699663a71b07d6ce18d40)
d1efb8
Resolves: rhbz#1688275
d1efb8
---
d1efb8
 src/vncconnection.c | 13 +++++++++----
d1efb8
 1 file changed, 9 insertions(+), 4 deletions(-)
d1efb8
d1efb8
diff --git a/src/vncconnection.c b/src/vncconnection.c
d1efb8
index aceb31d..65111fd 100644
d1efb8
--- a/src/vncconnection.c
d1efb8
+++ b/src/vncconnection.c
d1efb8
@@ -3638,33 +3638,38 @@ static gboolean vnc_connection_perform_auth_vnc(VncConnection *conn)
d1efb8
     error = gcry_cipher_open(&c, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0);
d1efb8
     if (gcry_err_code (error) != GPG_ERR_NO_ERROR) {
d1efb8
         VNC_DEBUG("gcry_cipher_open error: %s\n", gcry_strerror(error));
d1efb8
-        return FALSE;
d1efb8
+        goto error;
d1efb8
     }
d1efb8
 
d1efb8
     error = gcry_cipher_setkey(c, key, 8);
d1efb8
     if (gcry_err_code (error) != GPG_ERR_NO_ERROR) {
d1efb8
         VNC_DEBUG("gcry_cipher_setkey error: %s\n", gcry_strerror(error));
d1efb8
         gcry_cipher_close(c);
d1efb8
-        return FALSE;
d1efb8
+        goto error;
d1efb8
     }
d1efb8
 
d1efb8
     error = gcry_cipher_encrypt(c, challenge, 8, challenge, 8);
d1efb8
     if (gcry_err_code (error) != GPG_ERR_NO_ERROR) {
d1efb8
         VNC_DEBUG("gcry_cipher_encrypt error: %s\n", gcry_strerror(error));
d1efb8
         gcry_cipher_close(c);
d1efb8
-        return FALSE;
d1efb8
+        goto error;
d1efb8
     }
d1efb8
     error = gcry_cipher_encrypt(c, challenge + 8, 8, challenge + 8, 8);
d1efb8
     if (gcry_err_code (error) != GPG_ERR_NO_ERROR) {
d1efb8
         VNC_DEBUG("gcry_cipher_encrypt error: %s\n", gcry_strerror(error));
d1efb8
         gcry_cipher_close(c);
d1efb8
-        return FALSE;
d1efb8
+        goto error;
d1efb8
     }
d1efb8
     gcry_cipher_close(c);
d1efb8
 
d1efb8
     vnc_connection_write(conn, challenge, 16);
d1efb8
     vnc_connection_flush(conn);
d1efb8
     return vnc_connection_check_auth_result(conn);
d1efb8
+
d1efb8
+error:
d1efb8
+    vnc_connection_set_error(conn, "%s: %s", "Unknown authentication failure: %s",
d1efb8
+                             gcry_strerror(error));
d1efb8
+    return FALSE;
d1efb8
 }
d1efb8
 
d1efb8
 /*