cryptsetup: Treat key file errors as a failed password attempt

6f177c7dc0 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.
This commit is contained in:
Ryan Gonzalez
2019-02-26 10:48:07 +09:00
committed by Yu Watanabe
parent 510dc4da13
commit c20db38875
+4
View 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 {