coreutils/coreutils-selinux.patch

88 lines
2.8 KiB
Diff
Raw Normal View History

2021-09-26 16:15:09 +00:00
From d70ddb3eb845c494280e7365e2b889242e7e1bb9 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 4 Oct 2021 08:45:53 +0200
Subject: [PATCH] coreutils-selinux.patch
---
src/cp.c | 19 ++++++++++++++++++-
src/install.c | 12 +++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
2021-09-26 16:15:09 +00:00
2016-12-01 13:26:30 +00:00
diff --git a/src/cp.c b/src/cp.c
2021-09-26 16:15:09 +00:00
index c97a675..89fb8ec 100644
2016-12-01 13:26:30 +00:00
--- a/src/cp.c
+++ b/src/cp.c
@@ -952,7 +952,7 @@ main (int argc, char **argv)
2016-12-01 13:26:30 +00:00
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, NULL))
!= -1)
{
@@ -1000,6 +1000,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;
2016-12-01 13:26:30 +00:00
diff --git a/src/install.c b/src/install.c
2021-09-26 16:15:09 +00:00
index c9456fe..2b1bee9 100644
2016-12-01 13:26:30 +00:00
--- a/src/install.c
+++ b/src/install.c
@@ -794,7 +794,7 @@ main (int argc, char **argv)
2016-12-01 13:26:30 +00:00
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,
NULL)) != -1)
{
switch (optc)
@@ -855,6 +855,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)
{
@@ -862,6 +865,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;
2021-09-26 16:15:09 +00:00
--
2.31.1