[gtk-vnc] vnc-auth: emit "vnc-auth-failure" for weak key



commit e5008de225e97195e05598678c4cffc3f5e7b10b
Author: Jakub Janků <jjanku redhat com>
Date:   Wed Apr 28 12:06:26 2021 +0200

    vnc-auth: emit "vnc-auth-failure" for weak key
    
    In vnc_connection_perform_auth_vnc(), if the user enters an empty
    password, gcry_cipher_setkey() fails with GPG_ERR_WEAK_KEY.
    
    In such case, we want to give the useranother chance to reenter
    the password, as is the case when the password is incorrect.
    
    To enable that, the auth-failure signal needs to be emitted.
    
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1941398
    
    Signed-off-by: Jakub Janků <jjanku redhat com>

 src/vncconnection.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index b892920..731307a 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -3936,6 +3936,9 @@ static gboolean vnc_connection_perform_auth_vnc(VncConnection *conn)
     error = gcry_cipher_setkey(c, key, 8);
     if (gcry_err_code (error) != GPG_ERR_NO_ERROR) {
         VNC_DEBUG("gcry_cipher_setkey error: %s\n", gcry_strerror(error));
+        if (gcry_err_code(error) == GPG_ERR_WEAK_KEY) {
+            vnc_connection_auth_failure(conn, gcry_strerror(error));
+        }
         gcry_cipher_close(c);
         goto error;
     }


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