summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-01-31 13:55:54 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2016-01-31 14:23:46 +0000
commitf596e00f32766df011b322b1b0c700add0aae032 (patch)
treef897e1bf632d0f2105d025c0434163f76dc9052a
parent94bd732348535de399f8f003e3a1cbc8a81ab839 (diff)
core: let's check access before type modification
-rw-r--r--src/core/dbus-unit.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 7c7b50b99b..dca9f77528 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -986,6 +986,13 @@ int bus_unit_queue_job(
assert(type >= 0 && type < _JOB_TYPE_MAX);
assert(mode >= 0 && mode < _JOB_MODE_MAX);
+ r = mac_selinux_unit_access_check(
+ u, message,
+ job_type_to_access_method(type),
+ error);
+ if (r < 0)
+ return r;
+
if (reload_if_possible && unit_can_reload(u)) {
if (type == JOB_RESTART)
type = JOB_RELOAD_OR_START;
@@ -993,12 +1000,6 @@ int bus_unit_queue_job(
type = JOB_TRY_RELOAD;
}
- r = mac_selinux_unit_access_check(
- u, message,
- job_type_to_access_method(type),
- error);
- if (r < 0)
- return r;
if (type == JOB_STOP &&
(u->load_state == UNIT_NOT_FOUND || u->load_state == UNIT_ERROR) &&