]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: Treat key file errors as a failed password attempt
authorRyan Gonzalez <kirbyfan64@users.noreply.github.com>
Sat, 23 Feb 2019 05:45:03 +0000 (23:45 -0600)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 26 Feb 2019 01:48:07 +0000 (10:48 +0900)
6f177c7dc092eb68762b4533d41b14244adb2a73 caused key file errors to immediately fail, which would make it hard to correct an issue due to e.g. a crypttab typo or a damaged key file.

Closes #11723.

src/cryptsetup/cryptsetup.c

index 9cb52ddf264513e96775d50c3c7b2c7222418ed6..c8a4f82f86911dec66cf95748c1479b26cf1bdec 100644 (file)
@@ -557,6 +557,10 @@ static int attach_luks_or_plain(struct crypt_device *cd,
                         log_error_errno(r, "Failed to activate with key file '%s'. (Key data incorrect?)", key_file);
                         return -EAGAIN; /* Log actual error, but return EAGAIN */
                 }
+                if (r == -EINVAL) {
+                        log_error_errno(r, "Failed to activate with key file '%s'. (Key file missing?)", key_file);
+                        return -EAGAIN; /* Log actual error, but return EAGAIN */
+                }
                 if (r < 0)
                         return log_error_errno(r, "Failed to activate with key file '%s': %m", key_file);
         } else {