|
|
11ef81 |
From 2f135022f4372dc34198c48cfd67b91044e6dfd7 Mon Sep 17 00:00:00 2001
|
|
|
11ef81 |
From: Petr Lautrbach <plautrba@redhat.com>
|
|
|
11ef81 |
Date: Wed, 13 Jan 2021 22:09:48 +0100
|
|
|
11ef81 |
Subject: [PATCH] setfiles: drop ABORT_ON_ERRORS and related code
|
|
|
11ef81 |
|
|
|
11ef81 |
`setfiles -d` doesn't have any impact on number of errors before it
|
|
|
11ef81 |
aborts. It always aborts on first invalid context in spec file.
|
|
|
11ef81 |
|
|
|
11ef81 |
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
|
|
|
11ef81 |
---
|
|
|
11ef81 |
policycoreutils/setfiles/Makefile | 3 ---
|
|
|
11ef81 |
policycoreutils/setfiles/ru/setfiles.8 | 2 +-
|
|
|
11ef81 |
policycoreutils/setfiles/setfiles.8 | 3 +--
|
|
|
11ef81 |
policycoreutils/setfiles/setfiles.c | 18 ------------------
|
|
|
11ef81 |
4 files changed, 2 insertions(+), 24 deletions(-)
|
|
|
11ef81 |
|
|
|
11ef81 |
diff --git a/policycoreutils/setfiles/Makefile b/policycoreutils/setfiles/Makefile
|
|
|
11ef81 |
index bc5a8db789a5..a3bbbe116b7f 100644
|
|
|
11ef81 |
--- a/policycoreutils/setfiles/Makefile
|
|
|
11ef81 |
+++ b/policycoreutils/setfiles/Makefile
|
|
|
11ef81 |
@@ -5,8 +5,6 @@ SBINDIR ?= /sbin
|
|
|
11ef81 |
MANDIR = $(PREFIX)/share/man
|
|
|
11ef81 |
AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
|
|
|
11ef81 |
|
|
|
11ef81 |
-ABORT_ON_ERRORS=$(shell grep "^\#define ABORT_ON_ERRORS" setfiles.c | awk -S '{ print $$3 }')
|
|
|
11ef81 |
-
|
|
|
11ef81 |
CFLAGS ?= -g -Werror -Wall -W
|
|
|
11ef81 |
override LDLIBS += -lselinux -lsepol
|
|
|
11ef81 |
|
|
|
11ef81 |
@@ -26,7 +24,6 @@ restorecon_xattr: restorecon_xattr.o restore.o
|
|
|
11ef81 |
|
|
|
11ef81 |
man:
|
|
|
11ef81 |
@cp -af setfiles.8 setfiles.8.man
|
|
|
11ef81 |
- @sed -i "s/ABORT_ON_ERRORS/$(ABORT_ON_ERRORS)/g" setfiles.8.man
|
|
|
11ef81 |
|
|
|
11ef81 |
install: all
|
|
|
11ef81 |
[ -d $(DESTDIR)$(MANDIR)/man8 ] || mkdir -p $(DESTDIR)$(MANDIR)/man8
|
|
|
11ef81 |
diff --git a/policycoreutils/setfiles/ru/setfiles.8 b/policycoreutils/setfiles/ru/setfiles.8
|
|
|
11ef81 |
index 27815a3f1eee..910101452625 100644
|
|
|
11ef81 |
--- a/policycoreutils/setfiles/ru/setfiles.8
|
|
|
11ef81 |
+++ b/policycoreutils/setfiles/ru/setfiles.8
|
|
|
11ef81 |
@@ -47,7 +47,7 @@ setfiles \- установить SELinux-контексты безопаснос
|
|
|
11ef81 |
проверить действительность контекстов относительно указанной двоичной политики.
|
|
|
11ef81 |
.TP
|
|
|
11ef81 |
.B \-d
|
|
|
11ef81 |
-показать, какая спецификация соответствует каждому из файлов (не прекращать проверку после получения ошибок ABORT_ON_ERRORS).
|
|
|
11ef81 |
+показать, какая спецификация соответствует каждому из файлов.
|
|
|
11ef81 |
.TP
|
|
|
11ef81 |
.BI \-e \ directory
|
|
|
11ef81 |
исключить каталог (чтобы исключить более одного каталога, этот параметр необходимо использовать соответствующее количество раз).
|
|
|
11ef81 |
diff --git a/policycoreutils/setfiles/setfiles.8 b/policycoreutils/setfiles/setfiles.8
|
|
|
11ef81 |
index a8a76c860dac..b7d3cefb96ff 100644
|
|
|
11ef81 |
--- a/policycoreutils/setfiles/setfiles.8
|
|
|
11ef81 |
+++ b/policycoreutils/setfiles/setfiles.8
|
|
|
11ef81 |
@@ -56,8 +56,7 @@ option will force a replacement of the entire context.
|
|
|
11ef81 |
check the validity of the contexts against the specified binary policy.
|
|
|
11ef81 |
.TP
|
|
|
11ef81 |
.B \-d
|
|
|
11ef81 |
-show what specification matched each file (do not abort validation
|
|
|
11ef81 |
-after ABORT_ON_ERRORS errors). Not affected by "\-q"
|
|
|
11ef81 |
+show what specification matched each file. Not affected by "\-q"
|
|
|
11ef81 |
.TP
|
|
|
11ef81 |
.BI \-e \ directory
|
|
|
11ef81 |
directory to exclude (repeat option for more than one directory).
|
|
|
11ef81 |
diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c
|
|
|
11ef81 |
index 68eab45aa2b4..bcbdfbfe53e2 100644
|
|
|
11ef81 |
--- a/policycoreutils/setfiles/setfiles.c
|
|
|
11ef81 |
+++ b/policycoreutils/setfiles/setfiles.c
|
|
|
11ef81 |
@@ -23,14 +23,6 @@ static int nerr;
|
|
|
11ef81 |
|
|
|
11ef81 |
#define STAT_BLOCK_SIZE 1
|
|
|
11ef81 |
|
|
|
11ef81 |
-/* setfiles will abort its operation after reaching the
|
|
|
11ef81 |
- * following number of errors (e.g. invalid contexts),
|
|
|
11ef81 |
- * unless it is used in "debug" mode (-d option).
|
|
|
11ef81 |
- */
|
|
|
11ef81 |
-#ifndef ABORT_ON_ERRORS
|
|
|
11ef81 |
-#define ABORT_ON_ERRORS 10
|
|
|
11ef81 |
-#endif
|
|
|
11ef81 |
-
|
|
|
11ef81 |
#define SETFILES "setfiles"
|
|
|
11ef81 |
#define RESTORECON "restorecon"
|
|
|
11ef81 |
static int iamrestorecon;
|
|
|
11ef81 |
@@ -57,15 +49,6 @@ static __attribute__((__noreturn__)) void usage(const char *const name)
|
|
|
11ef81 |
exit(-1);
|
|
|
11ef81 |
}
|
|
|
11ef81 |
|
|
|
11ef81 |
-void inc_err(void)
|
|
|
11ef81 |
-{
|
|
|
11ef81 |
- nerr++;
|
|
|
11ef81 |
- if (nerr > ABORT_ON_ERRORS - 1 && !r_opts.debug) {
|
|
|
11ef81 |
- fprintf(stderr, "Exiting after %d errors.\n", ABORT_ON_ERRORS);
|
|
|
11ef81 |
- exit(-1);
|
|
|
11ef81 |
- }
|
|
|
11ef81 |
-}
|
|
|
11ef81 |
-
|
|
|
11ef81 |
void set_rootpath(const char *arg)
|
|
|
11ef81 |
{
|
|
|
11ef81 |
if (strlen(arg) == 1 && strncmp(arg, "/", 1) == 0) {
|
|
|
11ef81 |
@@ -98,7 +81,6 @@ int canoncon(char **contextp)
|
|
|
11ef81 |
*contextp = tmpcon;
|
|
|
11ef81 |
} else if (errno != ENOENT) {
|
|
|
11ef81 |
rc = -1;
|
|
|
11ef81 |
- inc_err();
|
|
|
11ef81 |
}
|
|
|
11ef81 |
|
|
|
11ef81 |
return rc;
|
|
|
11ef81 |
--
|
|
|
11ef81 |
2.30.0
|
|
|
11ef81 |
|