Commit a5c32cff authored by Harald Hoyer's avatar Harald Hoyer
Browse files

honor SELinux labels, when creating and writing config files

Also split out some fileio functions to fileio.c and provide a SELinux
aware pendant in fileio-label.c

see https://bugzilla.redhat.com/show_bug.cgi?id=881577
parent edc211f3
......@@ -623,6 +623,8 @@ libsystemd_shared_la_SOURCES = \
src/shared/time-dst.h \
src/shared/calendarspec.c \
src/shared/calendarspec.h \
src/shared/fileio.c \
src/shared/fileio.h \
src/shared/output-mode.h
#-------------------------------------------------------------------------------
......@@ -675,6 +677,8 @@ libsystemd_label_la_SOURCES = \
src/shared/mkdir.h \
src/shared/ask-password-api.c \
src/shared/ask-password-api.h \
src/shared/fileio-label.c \
src/shared/fileio-label.h \
src/shared/dev-setup.c \
src/shared/dev-setup.h
......@@ -2898,6 +2902,7 @@ systemd_hostnamed_CFLAGS = \
$(DBUS_CFLAGS)
systemd_hostnamed_LDADD = \
libsystemd-label.la \
libsystemd-shared.la \
libsystemd-daemon.la \
libsystemd-dbus.la
......@@ -3034,6 +3039,7 @@ systemd_timedated_CFLAGS = \
$(DBUS_CFLAGS)
systemd_timedated_LDADD = \
libsystemd-label.la \
libsystemd-shared.la \
libsystemd-daemon.la \
libsystemd-dbus.la
......
......@@ -31,6 +31,7 @@
#include "build.h"
#include "util.h"
#include "strxcpyx.h"
#include "fileio.h"
#define compare(a, b) (((a) > (b))? 1 : (((b) > (a))? -1 : 0))
#define svg(...) printf(__VA_ARGS__)
......
......@@ -33,6 +33,7 @@
#include "strv.h"
#include "util.h"
#include "conf-files.h"
#include "fileio.h"
static const char conf_file_dirs[] =
"/etc/binfmt.d\0"
......
......@@ -36,6 +36,7 @@
#include "bootchart.h"
#include "util.h"
#include "fileio.h"
double graph_start;
double log_start;
......
......@@ -31,6 +31,7 @@
#include "hashmap.h"
#include "cgroup-util.h"
#include "build.h"
#include "fileio.h"
typedef struct Group {
char *path;
......
......@@ -22,6 +22,7 @@
#include "cgroup-attr.h"
#include "cgroup-util.h"
#include "list.h"
#include "fileio.h"
int cgroup_attribute_apply(CGroupAttribute *a, CGroupBonding *b) {
int r;
......
......@@ -36,6 +36,7 @@
#include "condition.h"
#include "virt.h"
#include "path-util.h"
#include "fileio.h"
Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
Condition *c;
......
......@@ -29,6 +29,7 @@
#include "strv.h"
#include "dbus-common.h"
#include "syscall-list.h"
#include "fileio.h"
DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_input, exec_input, ExecInput);
DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_execute_append_output, exec_output, ExecOutput);
......
......@@ -30,6 +30,7 @@
#include "cgroup-util.h"
#include "strv.h"
#include "path-util.h"
#include "fileio.h"
const char bus_unit_interface[] _introspect_("Unit") = BUS_UNIT_INTERFACE;
......
......@@ -65,6 +65,7 @@
#include "path-util.h"
#include "syscall-list.h"
#include "env-util.h"
#include "fileio.h"
#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
......
......@@ -29,6 +29,7 @@
#include "macro.h"
#include "util.h"
#include "log.h"
#include "fileio.h"
static int read_and_strip_hostname(const char *path, char **hn) {
char *s;
......
......@@ -27,6 +27,7 @@
#include "util.h"
#include "macro.h"
#include "virt.h"
#include "fileio.h"
enum {
/* We don't list LC_ALL here on purpose. People should be
......
......@@ -35,6 +35,7 @@
#include "mkdir.h"
#include "log.h"
#include "virt.h"
#include "fileio.h"
static int shorten_uuid(char destination[36], const char *source) {
unsigned i, j;
......
......@@ -66,6 +66,7 @@
#include "locale-setup.h"
#include "selinux-setup.h"
#include "ima-setup.h"
#include "fileio.h"
static enum {
ACTION_RUN,
......
......@@ -43,6 +43,7 @@
#include "util.h"
#include "utf8.h"
#include "env-util.h"
#include "fileio.h"
#ifdef HAVE_SYSV_COMPAT
......
......@@ -46,6 +46,8 @@
#include "missing.h"
#include "cgroup-attr.h"
#include "mkdir.h"
#include "label.h"
#include "fileio-label.h"
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = &service_vtable,
......@@ -2778,7 +2780,7 @@ int unit_write_drop_in(Unit *u, bool runtime, const char *name, const char *data
return -ENOMEM;
mkdir_p(p, 0755);
return write_one_line_file_atomic(q, data);
return write_one_line_file_atomic_label(q, data);
}
int unit_remove_drop_in(Unit *u, bool runtime, const char *name) {
......
......@@ -35,6 +35,7 @@
#include "special.h"
#include "bus-errors.h"
#include "virt.h"
#include "fileio.h"
static bool arg_skip = false;
static bool arg_force = false;
......
......@@ -33,6 +33,7 @@
#include "special.h"
#include "mkdir.h"
#include "virt.h"
#include "fileio.h"
static const char *arg_dest = "/tmp";
static bool arg_enabled = true;
......
......@@ -28,6 +28,7 @@
#include "mkdir.h"
#include "unit-name.h"
#include "virt.h"
#include "fileio.h"
static const char *arg_dest = "/tmp";
......
......@@ -36,6 +36,7 @@
#include "strv.h"
#include "sd-id128.h"
#include "virt.h"
#include "fileio.h"
static enum transport {
TRANSPORT_NORMAL,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment