setools-4.6.0-2

- Fix seinfo argument parsing when policy path follows query options

Resolves: RHEL-118641
This commit is contained in:
Veronika Syncakova 2025-12-01 15:48:06 +01:00
parent 18a59bedcc
commit 8a87161202
2 changed files with 48 additions and 1 deletions

42
157.patch Normal file
View File

@ -0,0 +1,42 @@
From a33a2e394435316f3822e89ac9c2a9aabab17252 Mon Sep 17 00:00:00 2001
From: Pranav Lawate <pran.lawate@gmail.com>
Date: Tue, 30 Sep 2025 22:29:10 +0530
Subject: [PATCH] Fix seinfo argument parsing when policy path follows query
options
Signed-off-by: Pranav Lawate <pran.lawate@gmail.com>
---
seinfo | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/seinfo b/seinfo
index 99180c36..d04ec320 100755
--- a/seinfo
+++ b/seinfo
@@ -12,6 +12,7 @@ import logging
import signal
import ipaddress
import warnings
+from pathlib import Path
from typing import Callable, List, Tuple
@@ -102,6 +103,18 @@ xen.add_argument("--devicetreecon", help="Print all devicetreecon statements.",
args = parser.parse_args()
+# Fix argument misparsing: when policy is None and a query option is a string,
+# check if the string is actually a policy file that is incorrectly consumed by the query option
+if not args.policy:
+ # Check all query options defined in the queries argument group
+ for action in queries._group_actions:
+ value = getattr(args, action.dest, None)
+ if isinstance(value, str) and Path(value).exists():
+ # This query argument consumed the policy path - fix it
+ args.policy = value
+ setattr(args, action.dest, True)
+ break
+
if args.debug:
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s|%(levelname)s|%(name)s|%(message)s')

View File

@ -3,7 +3,7 @@
Name: setools
Version: 4.6.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Policy analysis tools for SELinux
License: GPL-2.0-only AND LGPL-2.1-only
@ -14,6 +14,8 @@ Source2: apol.desktop
# Remove redundant runtime requirement on setuptools
Patch: https://github.com/SELinuxProject/setools/pull/156.patch
# Fix seinfo argument parsing when policy path follows query
Patch: https://github.com/SELinuxProject/setools/pull/157.patch
Obsoletes: setools < 4.0.0, setools-devel < 4.0.0
BuildRequires: flex, bison
@ -148,6 +150,9 @@ Python modules designed to facilitate SELinux policy analysis.
%{_mandir}/ru/man1/apol*
%changelog
* Wed Dec 03 2025 Veronika Syncakova <vsyncako@redhat.com> - 4.6.0-2
- Fix seinfo argument parsing when policy path follows query options (RHEL-118641)
* Thu Oct 23 2025 Vit Mojzis <vmojzis@redhat.com> - 4.6.0-1
- SETools 4.6.0
- Drop redundant runtime requirement on python3-setuptools (redux)