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