Blame SOURCES/0030-Use-copy-when-replacing-files-to-keep-SELinux-contex.patch
|
|
403b09 |
From 602d1c5190cfb879f81ced19e60d1eb08bd559f0 Mon Sep 17 00:00:00 2001
|
|
|
403b09 |
From: Martin Basti <mbasti@redhat.com>
|
|
|
403b09 |
Date: Thu, 21 Jul 2016 18:49:57 +0200
|
|
|
403b09 |
Subject: [PATCH] Use copy when replacing files to keep SELinux context
|
|
|
403b09 |
|
|
|
403b09 |
When installer replaces any file with newer, it must use 'copy' instead of
|
|
|
403b09 |
'mv' to keep SELinux context valid.
|
|
|
403b09 |
|
|
|
403b09 |
https://fedorahosted.org/freeipa/ticket/6111
|
|
|
403b09 |
|
|
|
403b09 |
Reviewed-By: Petr Spacek <pspacek@redhat.com>
|
|
|
403b09 |
---
|
|
|
403b09 |
ipapython/ipautil.py | 6 +++++-
|
|
|
403b09 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
403b09 |
|
|
|
403b09 |
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
|
|
|
403b09 |
index 763a99c117e22a4ac49d8d34b38230f3da7c8435..9964fba4f694b57242b3bd3065a418917d977533 100644
|
|
|
403b09 |
--- a/ipapython/ipautil.py
|
|
|
403b09 |
+++ b/ipapython/ipautil.py
|
|
|
403b09 |
@@ -528,10 +528,14 @@ def dir_exists(filename):
|
|
|
403b09 |
except Exception:
|
|
|
403b09 |
return False
|
|
|
403b09 |
|
|
|
403b09 |
+
|
|
|
403b09 |
def install_file(fname, dest):
|
|
|
403b09 |
+ # SELinux: use copy to keep the right context
|
|
|
403b09 |
if file_exists(dest):
|
|
|
403b09 |
os.rename(dest, dest + ".orig")
|
|
|
403b09 |
- shutil.move(fname, dest)
|
|
|
403b09 |
+ shutil.copy(fname, dest)
|
|
|
403b09 |
+ os.remove(fname)
|
|
|
403b09 |
+
|
|
|
403b09 |
|
|
|
403b09 |
def backup_file(fname):
|
|
|
403b09 |
if file_exists(fname):
|
|
|
403b09 |
--
|
|
|
403b09 |
2.7.4
|
|
|
403b09 |
|