|
|
ae8ac59 |
From 2a97bf0e94be18d20d0ef671f50db1cc2d65c5e0 Mon Sep 17 00:00:00 2001
|
|
|
6037cb4 |
From: Evgeny Vereshchagin <evvers@ya.ru>
|
|
|
6037cb4 |
Date: Tue, 7 Jun 2016 20:47:41 +0300
|
|
|
6037cb4 |
Subject: [PATCH] hwdb: selinuxify a bit (#3460)
|
|
|
6037cb4 |
|
|
|
6037cb4 |
-bash-4.3# rm /etc/udev/hwdb.bin
|
|
|
6037cb4 |
-bash-4.3# systemd-hwdb update
|
|
|
6037cb4 |
-bash-4.3# ls -Z /etc/udev/hwdb.bin
|
|
|
6037cb4 |
system_u:object_r:systemd_hwdb_etc_t:s0 /etc/udev/hwdb.bin
|
|
|
6037cb4 |
|
|
|
6037cb4 |
Fixes: #3458
|
|
|
ae8ac59 |
(cherry picked from commit ea683512f9b82f2257770f0ed56d819eea230fc2)
|
|
|
6037cb4 |
---
|
|
|
6037cb4 |
src/hwdb/hwdb.c | 8 ++++++--
|
|
|
6037cb4 |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
6037cb4 |
|
|
|
6037cb4 |
diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c
|
|
|
ae8ac59 |
index 1160dacdf1..e12cd93d1c 100644
|
|
|
6037cb4 |
--- a/src/hwdb/hwdb.c
|
|
|
6037cb4 |
+++ b/src/hwdb/hwdb.c
|
|
|
6037cb4 |
@@ -29,7 +29,9 @@
|
|
|
6037cb4 |
#include "fs-util.h"
|
|
|
6037cb4 |
#include "hwdb-internal.h"
|
|
|
6037cb4 |
#include "hwdb-util.h"
|
|
|
6037cb4 |
+#include "label.h"
|
|
|
6037cb4 |
#include "mkdir.h"
|
|
|
6037cb4 |
+#include "selinux-util.h"
|
|
|
6037cb4 |
#include "strbuf.h"
|
|
|
6037cb4 |
#include "string-util.h"
|
|
|
6037cb4 |
#include "strv.h"
|
|
|
6037cb4 |
@@ -643,12 +645,12 @@ static int hwdb_update(int argc, char *argv[], void *userdata) {
|
|
|
6037cb4 |
if (!hwdb_bin)
|
|
|
6037cb4 |
return -ENOMEM;
|
|
|
6037cb4 |
|
|
|
6037cb4 |
- mkdir_parents(hwdb_bin, 0755);
|
|
|
6037cb4 |
+ mkdir_parents_label(hwdb_bin, 0755);
|
|
|
6037cb4 |
r = trie_store(trie, hwdb_bin);
|
|
|
6037cb4 |
if (r < 0)
|
|
|
6037cb4 |
return log_error_errno(r, "Failure writing database %s: %m", hwdb_bin);
|
|
|
6037cb4 |
|
|
|
6037cb4 |
- return 0;
|
|
|
6037cb4 |
+ return label_fix(hwdb_bin, false, false);
|
|
|
6037cb4 |
}
|
|
|
6037cb4 |
|
|
|
6037cb4 |
static void help(void) {
|
|
|
6037cb4 |
@@ -732,6 +734,8 @@ int main (int argc, char *argv[]) {
|
|
|
6037cb4 |
if (r <= 0)
|
|
|
6037cb4 |
goto finish;
|
|
|
6037cb4 |
|
|
|
6037cb4 |
+ mac_selinux_init();
|
|
|
6037cb4 |
+
|
|
|
6037cb4 |
r = hwdb_main(argc, argv);
|
|
|
6037cb4 |
|
|
|
6037cb4 |
finish:
|