2024-07-04 11:34:05 +00:00
|
|
|
From 78970c915b8556fcec4622e948a37dd8e34efe6d Mon Sep 17 00:00:00 2001
|
2021-09-26 16:15:09 +00:00
|
|
|
From: rpm-build <rpm-build>
|
2023-09-15 13:52:15 +00:00
|
|
|
Date: Wed, 30 Aug 2023 17:19:58 +0200
|
2021-09-26 16:15:09 +00:00
|
|
|
Subject: [PATCH] coreutils-selinux.patch
|
|
|
|
|
|
|
|
---
|
2023-01-02 12:24:04 +00:00
|
|
|
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
|
2024-07-04 11:34:05 +00:00
|
|
|
index 28b0217..897379f 100644
|
2016-12-01 13:26:30 +00:00
|
|
|
--- a/src/cp.c
|
|
|
|
+++ b/src/cp.c
|
2024-07-04 11:34:05 +00:00
|
|
|
@@ -997,7 +997,7 @@ main (int argc, char **argv)
|
2016-12-01 13:26:30 +00:00
|
|
|
selinux_enabled = (0 < is_selinux_enabled ());
|
|
|
|
cp_option_init (&x);
|
2009-11-18 14:48:00 +00:00
|
|
|
|
2013-12-14 17:41:07 +00:00
|
|
|
- while ((c = getopt_long (argc, argv, "abdfHilLnprst:uvxPRS:TZ",
|
|
|
|
+ while ((c = getopt_long (argc, argv, "abcdfHilLnprst:uvxPRS:TZ",
|
2023-09-15 13:52:15 +00:00
|
|
|
long_opts, nullptr))
|
2009-11-18 14:48:00 +00:00
|
|
|
!= -1)
|
|
|
|
{
|
2024-07-04 11:34:05 +00:00
|
|
|
@@ -1049,6 +1049,23 @@ main (int argc, char **argv)
|
2009-11-18 14:48:00 +00:00
|
|
|
copy_contents = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
+ case 'c':
|
2023-01-02 12:24:04 +00:00
|
|
|
+ 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)
|
|
|
|
+ {
|
2009-11-18 14:48:00 +00:00
|
|
|
+ x.preserve_security_context = true;
|
|
|
|
+ x.require_preserve_context = true;
|
2023-01-02 12:24:04 +00:00
|
|
|
+ }
|
2009-11-18 14:48:00 +00:00
|
|
|
+ break;
|
2023-01-02 12:24:04 +00:00
|
|
|
+
|
2009-11-18 14:48:00 +00:00
|
|
|
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
|
2024-07-04 11:34:05 +00:00
|
|
|
index accd0fd..b686fe9 100644
|
2016-12-01 13:26:30 +00:00
|
|
|
--- a/src/install.c
|
|
|
|
+++ b/src/install.c
|
2023-09-15 13:52:15 +00:00
|
|
|
@@ -807,7 +807,7 @@ main (int argc, char **argv)
|
2016-12-01 13:26:30 +00:00
|
|
|
dir_arg = false;
|
|
|
|
umask (0);
|
2009-11-18 14:48:00 +00:00
|
|
|
|
2013-12-14 17:41:07 +00:00
|
|
|
- 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,
|
2023-09-15 13:52:15 +00:00
|
|
|
nullptr))
|
|
|
|
!= -1)
|
2009-11-18 14:48:00 +00:00
|
|
|
{
|
2023-09-15 13:52:15 +00:00
|
|
|
@@ -872,6 +872,9 @@ main (int argc, char **argv)
|
2011-04-14 10:30:24 +00:00
|
|
|
no_target_directory = true;
|
|
|
|
break;
|
|
|
|
|
2009-11-18 14:48:00 +00:00
|
|
|
+ case 'P':
|
2023-01-02 12:24:04 +00:00
|
|
|
+ fprintf (stderr, "%s: warning: option '-P' is deprecated,"
|
|
|
|
+ " please use '--preserve-context' instead\n", argv[0]);
|
2009-11-18 14:48:00 +00:00
|
|
|
case PRESERVE_CONTEXT_OPTION:
|
2013-12-14 17:41:07 +00:00
|
|
|
if (! selinux_enabled)
|
2009-11-18 14:48:00 +00:00
|
|
|
{
|
2023-09-15 13:52:15 +00:00
|
|
|
@@ -879,6 +882,13 @@ main (int argc, char **argv)
|
2009-11-18 14:48:00 +00:00
|
|
|
"this kernel is not SELinux-enabled"));
|
|
|
|
break;
|
|
|
|
}
|
2023-01-02 12:24:04 +00:00
|
|
|
+ if (x.set_security_context)
|
|
|
|
+ {
|
|
|
|
+ fprintf (stderr,
|
|
|
|
+ "%s: cannot force target context and preserve it\n",
|
|
|
|
+ argv[0]);
|
|
|
|
+ exit (1);
|
|
|
|
+ }
|
2009-11-18 14:48:00 +00:00
|
|
|
x.preserve_security_context = true;
|
|
|
|
use_default_selinux_context = false;
|
|
|
|
break;
|
2021-09-26 16:15:09 +00:00
|
|
|
--
|
2024-07-04 11:34:05 +00:00
|
|
|
2.44.0
|
2021-09-26 16:15:09 +00:00
|
|
|
|