coreutils/coreutils-selinux.patch
Lukáš Zaoral bf0817f5a5
new upstream release 9.4
- enable integration with systemd
- fix the license field

Resolves: rhbz#2235759
2023-09-15 15:52:15 +02:00

88 lines
2.8 KiB
Diff

From 88ba186955add2b230c017749d5622f7a0d62177 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 30 Aug 2023 17:19:58 +0200
Subject: [PATCH] coreutils-selinux.patch
---
src/cp.c | 19 ++++++++++++++++++-
src/install.c | 12 +++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/cp.c b/src/cp.c
index 04a5cbe..7a364e5 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -989,7 +989,7 @@ main (int argc, char **argv)
selinux_enabled = (0 < is_selinux_enabled ());
cp_option_init (&x);
- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
long_opts, nullptr))
!= -1)
{
@@ -1041,6 +1041,23 @@ main (int argc, char **argv)
copy_contents = true;
break;
+ case 'c':
+ fprintf (stderr, "%s: warning: option '-c' is deprecated,"
+ " please use '--preserve=context' instead\n", argv[0]);
+ if (x.set_security_context)
+ {
+ fprintf (stderr,
+ "%s: cannot force target context and preserve it\n",
+ argv[0]);
+ exit (1);
+ }
+ else if (selinux_enabled)
+ {
+ x.preserve_security_context = true;
+ x.require_preserve_context = true;
+ }
+ break;
+
case 'd':
x.preserve_links = true;
x.dereference = DEREF_NEVER;
diff --git a/src/install.c b/src/install.c
index 31a48f1..ce9fa2d 100644
--- a/src/install.c
+++ b/src/install.c
@@ -807,7 +807,7 @@ main (int argc, char **argv)
dir_arg = false;
umask (0);
- while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z", long_options,
+ while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pPt:TvS:Z", long_options,
nullptr))
!= -1)
{
@@ -872,6 +872,9 @@ main (int argc, char **argv)
no_target_directory = true;
break;
+ case 'P':
+ fprintf (stderr, "%s: warning: option '-P' is deprecated,"
+ " please use '--preserve-context' instead\n", argv[0]);
case PRESERVE_CONTEXT_OPTION:
if (! selinux_enabled)
{
@@ -879,6 +882,13 @@ main (int argc, char **argv)
"this kernel is not SELinux-enabled"));
break;
}
+ if (x.set_security_context)
+ {
+ fprintf (stderr,
+ "%s: cannot force target context and preserve it\n",
+ argv[0]);
+ exit (1);
+ }
x.preserve_security_context = true;
use_default_selinux_context = false;
break;
--
2.41.0