Blame SOURCES/0342-cryptsetup-Treat-key-file-errors-as-a-failed-passwor.patch
Branch: 04e329225006c86654de9eb6aa0fe50e4c3c5104
5d2ee9
From ed282d8d84fa32aaef21994d92d1d3dbfa281094 Mon Sep 17 00:00:00 2001
5d2ee9
From: Ryan Gonzalez <kirbyfan64@users.noreply.github.com>
5d2ee9
Date: Fri, 22 Feb 2019 23:45:03 -0600
5d2ee9
Subject: [PATCH] cryptsetup: Treat key file errors as a failed password
5d2ee9
attempt
5d2ee9
5d2ee9
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.
5d2ee9
5d2ee9
Closes #11723.
5d2ee9
5d2ee9
(cherry picked from commit c20db3887569e0c0d9c0e2845c5286e7edf0133a)
5d2ee9
5d2ee9
Related: #1763155
5d2ee9
---
5d2ee9
src/cryptsetup/cryptsetup.c | 4 ++++
5d2ee9
1 file changed, 4 insertions(+)
5d2ee9
5d2ee9
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
5d2ee9
index 33c215eaa1..11162eb722 100644
5d2ee9
--- a/src/cryptsetup/cryptsetup.c
5d2ee9
+++ b/src/cryptsetup/cryptsetup.c
5d2ee9
@@ -558,6 +558,10 @@ static int attach_luks_or_plain(struct crypt_device *cd,
5d2ee9
log_error_errno(r, "Failed to activate with key file '%s'. (Key data incorrect?)", key_file);
5d2ee9
return -EAGAIN; /* Log actual error, but return EAGAIN */
5d2ee9
}
5d2ee9
+ if (r == -EINVAL) {
5d2ee9
+ log_error_errno(r, "Failed to activate with key file '%s'. (Key file missing?)", key_file);
5d2ee9
+ return -EAGAIN; /* Log actual error, but return EAGAIN */
5d2ee9
+ }
5d2ee9
if (r < 0)
5d2ee9
return log_error_errno(r, "Failed to activate with key file '%s': %m", key_file);
5d2ee9
} else {