From 1289cf220ff38b54ab7dad585e7b61e09cf454f0 Mon Sep 17 00:00:00 2001 From: lujie54 Date: Sat, 25 Jun 2022 16:25:17 +0800 Subject: [PATCH] rpm selinux plugin check context file exist --- ...inux-plugin-check-context-file-exist.patch | 27 +++++++++++++++++++ rpm.spec | 9 ++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 rpm-selinux-plugin-check-context-file-exist.patch diff --git a/rpm-selinux-plugin-check-context-file-exist.patch b/rpm-selinux-plugin-check-context-file-exist.patch new file mode 100644 index 0000000..cf3dc0d --- /dev/null +++ b/rpm-selinux-plugin-check-context-file-exist.patch @@ -0,0 +1,27 @@ +From 91d2535bb150a4e98ac72f87896f4acadda293d0 Mon Sep 17 00:00:00 2001 +From: luhuaxin <1539327763@qq.com> +Date: Tue, 26 Oct 2021 18:39:46 +0800 +Subject: [PATCH] rpm selinux plugin check context file exist + +Signed-off-by: lujie54 +--- + plugins/selinux.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/plugins/selinux.c b/plugins/selinux.c +index 7c1a0da..c909d18 100644 +--- a/plugins/selinux.c ++++ b/plugins/selinux.c +@@ -63,7 +63,8 @@ static rpmRC selinux_tsm_pre(rpmPlugin plugin, rpmts ts) + rpmRC rc = RPMRC_OK; + + /* If SELinux isn't enabled on the system, dont mess with it */ +- if (!is_selinux_enabled()) { ++ if (!is_selinux_enabled() || selinux_file_context_path() == NULL || ++ access(selinux_file_context_path(), F_OK)) { + rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_NOCONTEXTS)); + } + +-- +1.8.3.1 + diff --git a/rpm.spec b/rpm.spec index a8796a0..61cd1cf 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,6 +1,6 @@ Name: rpm Version: 4.17.0 -Release: 3 +Release: 4 Summary: RPM Package Manager License: GPLv2+ URL: http://www.rpm.org/ @@ -21,6 +21,7 @@ Patch12: fix-lsetxattr-error-in-container.patch Patch13: get-in-use-of-ndb.patch Patch14: backport-Use-root-as-default-UID_0_USER-and-UID_0_GROUP.patch Patch15: still-in-use-of-python-scripts-from-old-version.patch +Patch16: rpm-selinux-plugin-check-context-file-exist.patch BuildRequires: gcc autoconf automake libtool make gawk popt-devel openssl-devel readline-devel BuildRequires: zlib-devel libzstd-devel xz-devel bzip2-devel libarchive-devel ima-evm-utils-devel @@ -290,6 +291,12 @@ make check || (cat tests/rpmtests.log; exit 0) %{_mandir}/man1/gendiff.1* %changelog +*Sat Jun 25 2022 lujie - 4.17.0-4 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:rpm selinux plugin check context file exist + *Thu Feb 17 2022 renhongxun - 4.17.0-3 - Type:bugfix - ID:NA