diff --git a/backport-python-Use-isinstance-instead-of-type.patch b/backport-python-Use-isinstance-instead-of-type.patch new file mode 100644 index 0000000000000000000000000000000000000000..0086c5d7b4b90d27089401896e85d11d641746dc --- /dev/null +++ b/backport-python-Use-isinstance-instead-of-type.patch @@ -0,0 +1,35 @@ +From f6dc6acfa00707ce25c6357169111937f12512dd Mon Sep 17 00:00:00 2001 +From: James Carter +Date: Thu, 3 Aug 2023 09:40:24 -0400 +Subject: [PATCH] python: Use isinstance() instead of type() + +CI testing fails while running flake8 on python scripts with the +message "./python/semanage/seobject.py:250:16: E721 do not compare +types, for exact checks use `is` / `is not`, for instance checks use +`isinstance()`" + +Use "isinstance(args, str)" instead of "type(args) == str" + +Signed-off-by: James Carter + +Reference:https://github.com/SELinuxProject/selinux/commit/f6dc6acfa00707ce25c6357169111937f12512dd +Conflict:NA +--- + python/semanage/seobject.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py +index 361205d1..cc944ae2 100644 +--- a/python/semanage/seobject.py ++++ b/python/semanage/seobject.py +@@ -247,7 +247,7 @@ class semanageRecords: + global handle + if args: + # legacy code - args was store originally +- if type(args) == str: ++ if isinstance(args, str): + self.store = args + else: + self.args = args +-- +2.23.0 diff --git a/backport-restorecond-add-check-for-strdup-in-strings_list_add.patch b/backport-restorecond-add-check-for-strdup-in-strings_list_add.patch new file mode 100644 index 0000000000000000000000000000000000000000..166800d8b0c063c4a41d7de92831a92f7249a6f8 --- /dev/null +++ b/backport-restorecond-add-check-for-strdup-in-strings_list_add.patch @@ -0,0 +1,31 @@ +From 8730e0762e36ae214932e2a2a84aedd573462357 Mon Sep 17 00:00:00 2001 +From: Huaxin Lu +Date: Tue, 11 Jul 2023 06:49:33 +0800 +Subject: [PATCH] restorecond: add check for strdup in strings_list_add + +Check the return value of strdup() to avoid null pointer reference. + +Signed-off-by: Huaxin Lu +Acked-by: James Carter + +Reference:https://github.com/SELinuxProject/selinux/commit/8730e0762e36ae214932e2a2a84aedd573462357 +Conflict:NA +--- + restorecond/stringslist.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/restorecond/stringslist.c b/restorecond/stringslist.c +index f9404b1e..a76542a7 100644 +--- a/restorecond/stringslist.c ++++ b/restorecond/stringslist.c +@@ -48,6 +48,8 @@ void strings_list_add(struct stringsList **list, const char *string) + if (!newptr) + exitApp("Out of Memory"); + newptr->string = strdup(string); ++ if (!newptr->string) ++ exitApp("Out of Memory"); + newptr->next = ptr; + if (prev) + prev->next = newptr; +-- +2.23.0 diff --git a/policycoreutils.spec b/policycoreutils.spec index cc61e03114c5bc566a8734ac82c0fb3a04bae5ff..d1f983b8b3703befd2c61a17acfb6cb200fb9327 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -3,7 +3,7 @@ Name: policycoreutils Version: 3.3 -Release: 6 +Release: 7 Summary: Policy core utilities of selinux License: GPLv2 URL: https://github.com/SELinuxProject @@ -29,6 +29,8 @@ Patch6008: backport-sepolicy-Call-os.makedirs-with-exist_ok-True.patch Patch6009: backport-policycoreutils-fix-potential-NULL-reference-in-load_checks.patch Patch6010: backport-python-sepolicy-add-missing-booleans-to-man-pages.patch Patch6011: backport-python-sepolicy-Cache-conditional-rule-queries.patch +Patch6012: backport-restorecond-add-check-for-strdup-in-strings_list_add.patch +Patch6013: backport-python-Use-isinstance-instead-of-type.patch BuildRequires: gcc BuildRequires: pam-devel libsepol-static >= 3.3 libsemanage-static >= 3.3 libselinux-devel >= 3.3 libcap-devel audit-libs-devel gettext @@ -269,6 +271,9 @@ find %{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch} \ %{_mandir}/* %changelog +* Mon Sep 11 2023 zhangguangzhi -3.3-7 +- backport patches from upstream + * Wed Mar 22 2023 zhangguangzhi -3.3-6 - backport patches from upstream