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