1 Star 0 Fork 48

苏峰/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0342-cryptsetup-Treat-key-file-errors-as-a-failed-passwor.patch 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:59 . import systemd-239-29.el8.src.rpm
From ed282d8d84fa32aaef21994d92d1d3dbfa281094 Mon Sep 17 00:00:00 2001
From: Ryan Gonzalez <kirbyfan64@users.noreply.github.com>
Date: Fri, 22 Feb 2019 23:45:03 -0600
Subject: [PATCH] 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.
(cherry picked from commit c20db3887569e0c0d9c0e2845c5286e7edf0133a)
Related: #1763155
---
src/cryptsetup/cryptsetup.c | 4 ++++
1 file changed, 4 insertions(+)
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 {
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/su-feng-nmg/systemd.git
git@gitee.com:su-feng-nmg/systemd.git
su-feng-nmg
systemd
systemd
a8

搜索帮助