policycoreutils-3.3-5

- Improve error message when selabel_open fails
This commit is contained in:
Petr Lautrbach 2022-02-22 10:07:05 +01:00
parent 8be71ebc82
commit e68faf500b
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From d83caa39d7ff497bddabb54619a8985227ad1264 Mon Sep 17 00:00:00 2001
From: Vit Mojzis <vmojzis@redhat.com>
Date: Mon, 10 Jan 2022 18:35:27 +0100
Subject: [PATCH] policycoreutils: Improve error message when selabel_open
fails
When selabel_open fails to locate file_context files and
selabel_opt_path is not specified (e.g. when the policy type is
missconfigured in /etc/selinux/config), perror only prints
"No such file or directory".
This can be confusing in case of "restorecon" since it's
not apparent that the issue is in policy store.
Before:
\# restorecon -v /tmp/foo.txt
No such file or directory
After:
\# restorecon -v /tmp/foo.txt
/etc/selinux/yolo/contexts/files/file_contexts: No such file or directory
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
policycoreutils/setfiles/restore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/policycoreutils/setfiles/restore.c b/policycoreutils/setfiles/restore.c
index 74d48bb3752d..e9ae33ad039a 100644
--- a/policycoreutils/setfiles/restore.c
+++ b/policycoreutils/setfiles/restore.c
@@ -29,7 +29,7 @@ void restore_init(struct restore_opts *opts)
opts->hnd = selabel_open(SELABEL_CTX_FILE, selinux_opts, 3);
if (!opts->hnd) {
- perror(opts->selabel_opt_path);
+ perror(opts->selabel_opt_path ? opts->selabel_opt_path : selinux_file_context_path());
exit(1);
}
--
2.35.1

View File

@ -11,7 +11,7 @@
Summary: SELinux policy core utilities
Name: policycoreutils
Version: 3.3
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2
# https://github.com/SELinuxProject/selinux/wiki/Releases
Source0: https://github.com/SELinuxProject/selinux/releases/download/3.3/selinux-3.3.tar.gz
@ -56,6 +56,7 @@ Patch0022: 0022-semodule-Don-t-forget-to-munmap-data.patch
Patch0023: 0023-semodule-libsemanage-move-module-hashing-into-libsem.patch
Patch0024: 0024-semodule-add-command-line-option-to-detect-module-ch.patch
Patch0025: 0025-policycoreutils-fixfiles-Use-parallel-relabeling.patch
Patch0026: 0026-policycoreutils-Improve-error-message-when-selabel_o.patch
# Patch list end
Obsoletes: policycoreutils < 2.0.61-2
@ -482,6 +483,9 @@ The policycoreutils-restorecond package contains the restorecond service.
%systemd_postun_with_restart restorecond.service
%changelog
* Tue Feb 22 2022 Petr Lautrbach <plautrba@redhat.com> - 3.3-5
- Improve error message when selabel_open fails
* Sat Feb 19 2022 Petr Lautrbach <plautrba@redhat.com> - 3.3-4
- semodule: add command-line option to detect module changes
- fixfiles: Use parallel relabeling