[gnome-shell] automountManager: Add handling of udisks errors for no/wrong passwords



commit 7026a6fd325a2fe632d1f8b3fca2aeec3aa5f380
Author: Sebastian Pinnau <spinnau gmail com>
Date:   Thu Oct 11 19:14:25 2018 +0200

    automountManager: Add handling of udisks errors for no/wrong passwords
    
    If no password or a wrong password is entered after automounting an
    encrypted device, then the password should be reasked. However, this
    does not happen because the relevant udisks error messages for this
    cases are missing in the exception handler that calls _reaskPassword.
    
    Fix this issue by adding the relevant udisks error strings to the
    exception handling in the _onVolumeMounted method.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/640

 js/ui/components/automountManager.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/components/automountManager.js b/js/ui/components/automountManager.js
index 3e2dcd923..a64fc0d35 100644
--- a/js/ui/components/automountManager.js
+++ b/js/ui/components/automountManager.js
@@ -197,9 +197,13 @@ var AutomountManager = new Lang.Class({
             this._closeOperation(volume);
         } catch (e) {
             // FIXME: we will always get G_IO_ERROR_FAILED from the gvfs udisks
-            // backend in this case, see 
-            // https://bugs.freedesktop.org/show_bug.cgi?id=51271
-            if (e.message.indexOf('No key available with this passphrase') != -1) {
+            // backend, see https://bugs.freedesktop.org/show_bug.cgi?id=51271
+            // To reask the password if the user input was empty or wrong, we
+            // will check for corresponding error messages. However, these
+            // error strings are not unique for the cases in the comments below.
+            if (e.message.includes('No key available with this passphrase') || // cryptsetup
+                e.message.includes('No key available to unlock device') ||     // udisks (no password)
+                e.message.includes('Error unlocking')) {                       // udisks (wrong password)
                 this._reaskPassword(volume);
             } else {
                 if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))


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