summaryrefslogtreecommitdiffstats
path: root/src/cryptsetup
diff options
context:
space:
mode:
authorRyan Gonzalez <kirbyfan64@users.noreply.github.com>2019-02-23 06:45:03 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-02-26 02:48:07 +0100
commitc20db3887569e0c0d9c0e2845c5286e7edf0133a (patch)
treee7af9f936c48c33c85076cfba0481c1f1d614dce /src/cryptsetup
parentMerge pull request #11767 from yuwata/network-bridge-enslaved (diff)
downloadsystemd-c20db3887569e0c0d9c0e2845c5286e7edf0133a.tar.xz
systemd-c20db3887569e0c0d9c0e2845c5286e7edf0133a.zip
cryptsetup: Treat key file errors as a failed password attempt
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.
Diffstat (limited to 'src/cryptsetup')
-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 9cb52ddf26..c8a4f82f86 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -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 {