summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Gonzalez <kirbyfan64@users.noreply.github.com>2019-02-22 23:45:03 -0600
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>2020-03-20 10:05:21 +0100
commited282d8d84fa32aaef21994d92d1d3dbfa281094 (patch)
tree226ea7e7532c09142cc22251b84cedcd482d765a
parent0bef8805c81eecfe3960bf00b6022837e4979198 (diff)
downloadsystemd-ed282d8d84fa32aaef21994d92d1d3dbfa281094.tar.gz
cryptsetup: Treat key file errors as a failed password attemptv239-29
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. (cherry picked from commit c20db3887569e0c0d9c0e2845c5286e7edf0133a) Related: #1763155
-rw-r--r--src/cryptsetup/cryptsetup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 33c215eaa1..11162eb722 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -558,6 +558,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 {