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

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