Skip to content

Commit

Permalink
core: let's check access before type modification
Browse files Browse the repository at this point in the history
  • Loading branch information
evverx committed Jan 31, 2016
1 parent 94bd732 commit f596e00
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/core/dbus-unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,19 +986,20 @@ 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;
else if (type == JOB_TRY_RESTART)
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) &&
Expand Down

0 comments on commit f596e00

Please sign in to comment.