加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Use-user.digest_list-to-avoid-duplicate-processing-o.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
From e07cef55252fddf45ff39e264097c04a726d0d79 Mon Sep 17 00:00:00 2001
From: Roberto Sassu <roberto.sassu@huawei.com>
Date: Fri, 7 Aug 2020 09:32:27 +0200
Subject: [PATCH] Use user.digest_list to avoid duplicate processing of the
digest lists
---
plugins/digest_list.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/plugins/digest_list.c b/plugins/digest_list.c
index beb397309..9fcb5c4c5 100644
--- a/plugins/digest_list.c
+++ b/plugins/digest_list.c
@@ -417,7 +417,7 @@ static int process_digest_list(rpmte te, int parser)
DIGEST_LIST_DEFAULT_PATH, rpmteN(te), rpmteV(te),
rpmteR(te), rpmteA(te));
- size = lgetxattr(path, XATTR_NAME_IMA, NULL, 0);
+ size = lgetxattr(path, "user.digest_list", NULL, 0);
/* Don't upload again if digest list was already processed */
if ((rpmteType(te) == TR_ADDED && size > 0) ||
@@ -446,6 +446,14 @@ static int process_digest_list(rpmte te, int parser)
ret = RPMRC_FAIL;
goto out;
}
+
+ ret = lsetxattr(path, "user.digest_list", "1", 1, 0);
+ if (ret < 0)
+ rpmlog(RPMLOG_ERR, "digest_list: cannot add "
+ "user.digest_list to '%s'\n", path);
+ else
+ rpmlog(RPMLOG_DEBUG, "digest_list: user.digest_list "
+ "successfully added to '%s'\n", path);
}
/* Upload digest list to securityfs */
@@ -457,12 +465,12 @@ static int process_digest_list(rpmte te, int parser)
goto out;
}
- ret = lremovexattr(path, XATTR_NAME_IMA);
+ ret = lremovexattr(path, "user.digest_list");
if (ret < 0)
rpmlog(RPMLOG_ERR, "digest_list: cannot remove "
- "security.ima from '%s'\n", path);
+ "user.digest_list from '%s'\n", path);
else
- rpmlog(RPMLOG_DEBUG, "digest_list: security.ima "
+ rpmlog(RPMLOG_DEBUG, "digest_list: user.digest_list "
"successfully removed from '%s'\n", path);
}
out:
--
2.27.GIT
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化