]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: make sure to return EAGAIN on wrong tcrypt password too
authorLennart Poettering <lennart@poettering.net>
Wed, 29 Apr 2020 16:17:33 +0000 (18:17 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 May 2020 15:28:29 +0000 (17:28 +0200)
Only then we'll try again to ask the user for a password.

Fixes: #12152
src/cryptsetup/cryptsetup.c

index f6a9a21caa54d88aa33f1432dce419426c4212ac..9ff10d8aaaabf2ba9e685e1f79f82c58ecc4a1a5 100644 (file)
@@ -512,15 +512,13 @@ static int attach_tcrypt(
         r = crypt_load(cd, CRYPT_TCRYPT, &params);
         if (r < 0) {
                 if (r == -EPERM) {
-                        if (key_data) {
+                        if (key_data)
                                 log_error_errno(r, "Failed to activate using discovered key. (Key not correct?)");
-                                return -EAGAIN; /* log the actual error, but return EAGAIN */
-                        }
 
-                        if (key_file) {
+                        if (key_file)
                                 log_error_errno(r, "Failed to activate using password file '%s'. (Key data not correct?)", key_file);
-                                return -EAGAIN; /* log the actual error, but return EAGAIN */
-                        }
+
+                        return -EAGAIN; /* log the actual error, but return EAGAIN */
                 }
 
                 return log_error_errno(r, "Failed to load tcrypt superblock on device %s: %m", crypt_get_device_name(cd));