!36 Use user.digest_list to avoid duplicate processing of the digest lists

From: @nettingsisyphus
Reviewed-by: @zhujianwei001
Signed-off-by: @zhujianwei001
This commit is contained in:
openeuler-ci-bot 2020-12-17 19:05:52 +08:00 committed by Gitee
commit 16759e37cf
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,57 @@
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

View File

@ -1,6 +1,6 @@
Name: rpm
Version: 4.15.1
Release: 18
Release: 19
Summary: RPM Package Manager
License: GPLv2+
URL: http://www.rpm.org/
@ -22,6 +22,7 @@ Patch12: Use-common-error-logic-regardless-of-setexecfilecon-.patch
Patch13: Generate-digest-lists.patch
Patch14: Add-digest-list-plugin.patch
Patch15: Don-t-add-dist-to-release-if-it-is-already-there.patch
Patch16: Use-user.digest_list-to-avoid-duplicate-processing-o.patch
BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel libdb-devel
BuildRequires: zlib-devel libzstd-devel xz-devel bzip2-devel libarchive-devel ima-evm-utils-devel
@ -270,6 +271,12 @@ make check || (cat tests/rpmtests.log; exit 0)
%{_mandir}/man1/gendiff.1*
%changelog
* Thu Dec 17 2020 Anakin Zhang <benjamin93@163.com> - 4.15.1-19
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:use user.digest_list to avoid duplicate processing of the digest lists
* Thu Oct 29 2020 Liquor <lirui130@huawei.com> - 4.15.1-18
- Type:requirement
- ID:NA