dbus-manager.c   dbus-manager.c 
skipping to change at line 37 skipping to change at line 37
#include "build.h" #include "build.h"
#include "install.h" #include "install.h"
#include "selinux-access.h" #include "selinux-access.h"
#include "watchdog.h" #include "watchdog.h"
#include "clock-util.h" #include "clock-util.h"
#include "path-util.h" #include "path-util.h"
#include "virt.h" #include "virt.h"
#include "architecture.h" #include "architecture.h"
#include "env-util.h" #include "env-util.h"
#include "dbus.h" #include "dbus.h"
#include "dbus-job.h"
#include "dbus-manager.h" #include "dbus-manager.h"
#include "dbus-unit.h" #include "dbus-unit.h"
#include "dbus-snapshot.h" #include "dbus-snapshot.h"
#include "dbus-execute.h" #include "dbus-execute.h"
#include "bus-errors.h" #include "bus-errors.h"
static int property_get_version( static int property_get_version(
sd_bus *bus, sd_bus *bus,
const char *path, const char *path,
const char *interface, const char *interface,
skipping to change at line 355 skipping to change at line 356
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
u = manager_get_unit(m, name); u = manager_get_unit(m, name);
if (!u) if (!u)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s not loaded.", name); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s not loaded.", name);
r = selinux_unit_access_check(u, message, "status", error); r = selinux_unit_access_check(u, message, "status", error);
if (r < 0) if (r < 0)
skipping to change at line 387 skipping to change at line 390
pid_t pid; pid_t pid;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
assert_cc(sizeof(pid_t) == sizeof(uint32_t)); assert_cc(sizeof(pid_t) == sizeof(uint32_t));
/* Anyone can call this method */
r = sd_bus_message_read(message, "u", &pid); r = sd_bus_message_read(message, "u", &pid);
if (r < 0) if (r < 0)
return r; return r;
if (pid == 0) { if (pid == 0) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL; _cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID, &c reds); r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_PID, &c reds);
if (r < 0) if (r < 0)
return r; return r;
skipping to change at line 429 skipping to change at line 434
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
r = manager_load_unit(m, name, NULL, error, &u); r = manager_load_unit(m, name, NULL, error, &u);
if (r < 0) if (r < 0)
return r; return r;
r = selinux_unit_access_check(u, message, "status", error); r = selinux_unit_access_check(u, message, "status", error);
if (r < 0) if (r < 0)
skipping to change at line 457 skipping to change at line 464
static int method_start_unit_generic(sd_bus *bus, sd_bus_message *message, Manager *m, JobType job_type, bool reload_if_possible, sd_bus_error *error) { static int method_start_unit_generic(sd_bus *bus, sd_bus_message *message, Manager *m, JobType job_type, bool reload_if_possible, sd_bus_error *error) {
const char *name; const char *name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
r = manager_load_unit(m, name, NULL, error, &u); r = manager_load_unit(m, name, NULL, error, &u);
if (r < 0) if (r < 0)
return r; return r;
return bus_unit_method_start_generic(bus, message, u, job_type, rel oad_if_possible, error); return bus_unit_method_start_generic(bus, message, u, job_type, rel oad_if_possible, error);
} }
skipping to change at line 506 skipping to change at line 519
static int method_start_unit_replace(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { static int method_start_unit_replace(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
const char *old_name; const char *old_name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read(message, "s", &old_name); r = sd_bus_message_read(message, "s", &old_name);
if (r < 0) if (r < 0)
return r; return r;
u = manager_get_unit(m, old_name); u = manager_get_unit(m, old_name);
if (!u || !u->job || u->job->type != JOB_START) if (!u || !u->job || u->job->type != JOB_START)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "No job queued for unit %s", old_name); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "No job queued for unit %s", old_name);
return method_start_unit_generic(bus, message, m, JOB_START, false, error); return method_start_unit_generic(bus, message, m, JOB_START, false, error);
} }
skipping to change at line 527 skipping to change at line 546
static int method_kill_unit(sd_bus *bus, sd_bus_message *message, void *use rdata, sd_bus_error *error) { static int method_kill_unit(sd_bus *bus, sd_bus_message *message, void *use rdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Like bus_verify_manage_unit_async(), but uses CAP_SYS_KILL */
r = bus_verify_manage_unit_async_for_kill(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
u = manager_get_unit(m, name); u = manager_get_unit(m, name);
if (!u) if (!u)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s is not loaded.", name); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s is not loaded.", name);
return bus_unit_method_kill(bus, message, u, error); return bus_unit_method_kill(bus, message, u, error);
} }
skipping to change at line 548 skipping to change at line 574
static int method_reset_failed_unit(sd_bus *bus, sd_bus_message *message, v oid *userdata, sd_bus_error *error) { static int method_reset_failed_unit(sd_bus *bus, sd_bus_message *message, v oid *userdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
u = manager_get_unit(m, name); u = manager_get_unit(m, name);
if (!u) if (!u)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s is not loaded.", name); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s is not loaded.", name);
return bus_unit_method_reset_failed(bus, message, u, error); return bus_unit_method_reset_failed(bus, message, u, error);
} }
skipping to change at line 569 skipping to change at line 601
static int method_set_unit_properties(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { static int method_set_unit_properties(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
u = manager_get_unit(m, name); u = manager_get_unit(m, name);
if (!u) if (!u)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s is not loaded.", name); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_UNIT, "Un it %s is not loaded.", name);
return bus_unit_method_set_properties(bus, message, u, error); return bus_unit_method_set_properties(bus, message, u, error);
} }
skipping to change at line 592 skipping to change at line 630
Manager *m = userdata; Manager *m = userdata;
JobMode mode; JobMode mode;
UnitType t; UnitType t;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read(message, "ss", &name, &smode); r = sd_bus_message_read(message, "ss", &name, &smode);
if (r < 0) if (r < 0)
return r; return r;
t = unit_name_to_type(name); t = unit_name_to_type(name);
if (t < 0) if (t < 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit type."); return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit type.");
if (!unit_vtable[t]->can_transient) if (!unit_vtable[t]->can_transient)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit type %s does not support transient units.", unit_type_to_string(t)); return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unit type %s does not support transient units.", unit_type_to_string(t));
skipping to change at line 651 skipping to change at line 695
_cleanup_free_ char *path = NULL; _cleanup_free_ char *path = NULL;
Manager *m = userdata; Manager *m = userdata;
uint32_t id; uint32_t id;
Job *j; Job *j;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = sd_bus_message_read(message, "u", &id); r = sd_bus_message_read(message, "u", &id);
if (r < 0) if (r < 0)
return r; return r;
j = manager_get_job(m, id); j = manager_get_job(m, id);
if (!j) if (!j)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id);
r = selinux_unit_access_check(j->unit, message, "status", error); r = selinux_unit_access_check(j->unit, message, "status", error);
if (r < 0) if (r < 0)
skipping to change at line 688 skipping to change at line 734
assert(m); assert(m);
r = sd_bus_message_read(message, "u", &id); r = sd_bus_message_read(message, "u", &id);
if (r < 0) if (r < 0)
return r; return r;
j = manager_get_job(m, id); j = manager_get_job(m, id);
if (!j) if (!j)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id); return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_JOB, "Job %u does not exist.", (unsigned) id);
r = selinux_unit_access_check(j->unit, message, "stop", error); return bus_job_method_cancel(bus, message, j, error);
if (r < 0)
return r;
job_finish_and_invalidate(j, JOB_CANCELED, true);
return sd_bus_reply_method_return(message, NULL);
} }
static int method_clear_jobs(sd_bus *bus, sd_bus_message *message, void *us erdata, sd_bus_error *error) { static int method_clear_jobs(sd_bus *bus, sd_bus_message *message, void *us erdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
skipping to change at line 743 skipping to change at line 783
Manager *m = userdata; Manager *m = userdata;
const char *k; const char *k;
Iterator i; Iterator i;
Unit *u; Unit *u;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_new_method_return(message, &reply); r = sd_bus_message_new_method_return(message, &reply);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_open_container(reply, 'a', "(ssssssouso)"); r = sd_bus_message_open_container(reply, 'a', "(ssssssouso)");
if (r < 0) if (r < 0)
skipping to change at line 829 skipping to change at line 871
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL; _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
Manager *m = userdata; Manager *m = userdata;
Iterator i; Iterator i;
Job *j; Job *j;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_new_method_return(message, &reply); r = sd_bus_message_new_method_return(message, &reply);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_open_container(reply, 'a', "(usssoo)"); r = sd_bus_message_open_container(reply, 'a', "(usssoo)");
if (r < 0) if (r < 0)
skipping to change at line 879 skipping to change at line 923
} }
static int method_subscribe(sd_bus *bus, sd_bus_message *message, void *use rdata, sd_bus_error *error) { static int method_subscribe(sd_bus *bus, sd_bus_message *message, void *use rdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
if (bus == m->api_bus) { if (bus == m->api_bus) {
/* Note that direct bus connection subscribe by /* Note that direct bus connection subscribe by
* default, we only track peers on the API bus here */ * default, we only track peers on the API bus here */
if (!m->subscribed) { if (!m->subscribed) {
skipping to change at line 912 skipping to change at line 958
} }
static int method_unsubscribe(sd_bus *bus, sd_bus_message *message, void *u serdata, sd_bus_error *error) { static int method_unsubscribe(sd_bus *bus, sd_bus_message *message, void *u serdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
if (bus == m->api_bus) { if (bus == m->api_bus) {
r = sd_bus_track_remove_sender(m->subscribed, message); r = sd_bus_track_remove_sender(m->subscribed, message);
if (r < 0) if (r < 0)
return r; return r;
if (r == 0) if (r == 0)
return sd_bus_error_setf(error, BUS_ERROR_NOT_SUBSC RIBED, "Client is not subscribed."); return sd_bus_error_setf(error, BUS_ERROR_NOT_SUBSC RIBED, "Client is not subscribed.");
skipping to change at line 938 skipping to change at line 986
_cleanup_free_ char *dump = NULL; _cleanup_free_ char *dump = NULL;
_cleanup_fclose_ FILE *f = NULL; _cleanup_fclose_ FILE *f = NULL;
Manager *m = userdata; Manager *m = userdata;
size_t size; size_t size;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
f = open_memstream(&dump, &size); f = open_memstream(&dump, &size);
if (!f) if (!f)
return -ENOMEM; return -ENOMEM;
manager_dump_units(m, f, NULL); manager_dump_units(m, f, NULL);
manager_dump_jobs(m, f, NULL); manager_dump_jobs(m, f, NULL);
skipping to change at line 1027 skipping to change at line 1077
} }
static int method_reload(sd_bus *bus, sd_bus_message *message, void *userda ta, sd_bus_error *error) { static int method_reload(sd_bus *bus, sd_bus_message *message, void *userda ta, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_reload_daemon_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = selinux_access_check(message, "reload", error); r = selinux_access_check(message, "reload", error);
if (r < 0) if (r < 0)
return r; return r;
/* Instead of sending the reply back right away, we just /* Instead of sending the reply back right away, we just
* remember that we need to and then send it after the reload * remember that we need to and then send it after the reload
* is finished. That way the caller knows when the reload * is finished. That way the caller knows when the reload
* finished. */ * finished. */
assert(!m->queued_message); assert(!m->queued_message);
skipping to change at line 1055 skipping to change at line 1111
} }
static int method_reexecute(sd_bus *bus, sd_bus_message *message, void *use rdata, sd_bus_error *error) { static int method_reexecute(sd_bus *bus, sd_bus_message *message, void *use rdata, sd_bus_error *error) {
Manager *m = userdata; Manager *m = userdata;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_reload_daemon_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = selinux_access_check(message, "reload", error); r = selinux_access_check(message, "reload", error);
if (r < 0) if (r < 0)
return r; return r;
/* We don't send a reply back here, the client should /* We don't send a reply back here, the client should
* just wait for us disconnecting. */ * just wait for us disconnecting. */
m->exit_code = MANAGER_REEXECUTE; m->exit_code = MANAGER_REEXECUTE;
return 1; return 1;
} }
skipping to change at line 1329 skipping to change at line 1391
Manager *m = userdata; Manager *m = userdata;
UnitFileList *item; UnitFileList *item;
Hashmap *h; Hashmap *h;
Iterator i; Iterator i;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_new_method_return(message, &reply); r = sd_bus_message_new_method_return(message, &reply);
if (r < 0) if (r < 0)
return r; return r;
h = hashmap_new(string_hash_func, string_compare_func); h = hashmap_new(string_hash_func, string_compare_func);
if (!h) if (!h)
skipping to change at line 1380 skipping to change at line 1444
Manager *m = userdata; Manager *m = userdata;
const char *name; const char *name;
UnitFileState state; UnitFileState state;
UnitFileScope scope; UnitFileScope scope;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read(message, "s", &name); r = sd_bus_message_read(message, "s", &name);
if (r < 0) if (r < 0)
return r; return r;
scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_F ILE_USER; scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_F ILE_USER;
skipping to change at line 1407 skipping to change at line 1473
static int method_get_default_target(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { static int method_get_default_target(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_free_ char *default_target = NULL; _cleanup_free_ char *default_target = NULL;
Manager *m = userdata; Manager *m = userdata;
UnitFileScope scope; UnitFileScope scope;
int r; int r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
/* Anyone can call this method */
r = selinux_access_check(message, "status", error); r = selinux_access_check(message, "status", error);
if (r < 0) if (r < 0)
return r; return r;
scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_F ILE_USER; scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_F ILE_USER;
r = unit_file_get_default(scope, NULL, &default_target); r = unit_file_get_default(scope, NULL, &default_target);
if (r < 0) if (r < 0)
return r; return r;
skipping to change at line 1508 skipping to change at line 1576
#endif #endif
UnitFileChange *changes = NULL; UnitFileChange *changes = NULL;
unsigned n_changes = 0; unsigned n_changes = 0;
UnitFileScope scope; UnitFileScope scope;
int runtime, force, r; int runtime, force, r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_files_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read_strv(message, &l); r = sd_bus_message_read_strv(message, &l);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read(message, "bb", &runtime, &force); r = sd_bus_message_read(message, "bb", &runtime, &force);
if (r < 0) if (r < 0)
return r; return r;
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
STRV_FOREACH(i, l) { STRV_FOREACH(i, l) {
skipping to change at line 1580 skipping to change at line 1654
Manager *m = userdata; Manager *m = userdata;
UnitFilePresetMode mm; UnitFilePresetMode mm;
UnitFileScope scope; UnitFileScope scope;
int runtime, force, r; int runtime, force, r;
const char *mode; const char *mode;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_files_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = sd_bus_message_read_strv(message, &l); r = sd_bus_message_read_strv(message, &l);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read(message, "sbb", &mode, &runtime, &force); r = sd_bus_message_read(message, "sbb", &mode, &runtime, &force);
if (r < 0) if (r < 0)
return r; return r;
if (isempty(mode)) if (isempty(mode))
mm = UNIT_FILE_PRESET_FULL; mm = UNIT_FILE_PRESET_FULL;
skipping to change at line 1636 skipping to change at line 1716
_cleanup_strv_free_ char **l = NULL; _cleanup_strv_free_ char **l = NULL;
UnitFileChange *changes = NULL; UnitFileChange *changes = NULL;
unsigned n_changes = 0; unsigned n_changes = 0;
UnitFileScope scope; UnitFileScope scope;
int r, runtime; int r, runtime;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_files_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = selinux_access_check(message, verb, error); r = selinux_access_check(message, verb, error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read_strv(message, &l); r = sd_bus_message_read_strv(message, &l);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read(message, "b", &runtime); r = sd_bus_message_read(message, "b", &runtime);
if (r < 0) if (r < 0)
skipping to change at line 1677 skipping to change at line 1763
unsigned n_changes = 0; unsigned n_changes = 0;
Manager *m = userdata; Manager *m = userdata;
UnitFileScope scope; UnitFileScope scope;
const char *name; const char *name;
int force, r; int force, r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_files_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = selinux_access_check(message, "enable", error); r = selinux_access_check(message, "enable", error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read(message, "sb", &name, &force); r = sd_bus_message_read(message, "sb", &name, &force);
if (r < 0) if (r < 0)
return r; return r;
scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_F ILE_USER; scope = m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_F ILE_USER;
skipping to change at line 1707 skipping to change at line 1799
Manager *m = userdata; Manager *m = userdata;
UnitFilePresetMode mm; UnitFilePresetMode mm;
UnitFileScope scope; UnitFileScope scope;
const char *mode; const char *mode;
int force, runtime, r; int force, runtime, r;
assert(bus); assert(bus);
assert(message); assert(message);
assert(m); assert(m);
r = bus_verify_manage_unit_files_async(m, message, error);
if (r < 0)
return r;
if (r == 0)
return 1; /* No authorization for now, but the async polkit
stuff will call us again when it has it */
r = selinux_access_check(message, "enable", error); r = selinux_access_check(message, "enable", error);
if (r < 0) if (r < 0)
return r; return r;
r = sd_bus_message_read(message, "sbb", &mode, &runtime, &force); r = sd_bus_message_read(message, "sbb", &mode, &runtime, &force);
if (r < 0) if (r < 0)
return r; return r;
if (isempty(mode)) if (isempty(mode))
mm = UNIT_FILE_PRESET_FULL; mm = UNIT_FILE_PRESET_FULL;
skipping to change at line 1774 skipping to change at line 1872
SD_BUS_PROPERTY("DefaultStandardOutput", "s", bus_property_get_exec _output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONS T), SD_BUS_PROPERTY("DefaultStandardOutput", "s", bus_property_get_exec _output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONS T),
SD_BUS_PROPERTY("DefaultStandardError", "s", bus_property_get_exec_ output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST ), SD_BUS_PROPERTY("DefaultStandardError", "s", bus_property_get_exec_ output, offsetof(Manager, default_std_output), SD_BUS_VTABLE_PROPERTY_CONST ),
SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", bus_property_g et_usec, property_set_runtime_watchdog, offsetof(Manager, runtime_watchdog) , SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_WRITABLE_PROPERTY("RuntimeWatchdogUSec", "t", bus_property_g et_usec, property_set_runtime_watchdog, offsetof(Manager, runtime_watchdog) , SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_WRITABLE_PROPERTY("ShutdownWatchdogUSec", "t", bus_property_ get_usec, bus_property_set_usec, offsetof(Manager, shutdown_watchdog), SD_B US_VTABLE_PROPERTY_CONST), SD_BUS_WRITABLE_PROPERTY("ShutdownWatchdogUSec", "t", bus_property_ get_usec, bus_property_set_usec, offsetof(Manager, shutdown_watchdog), SD_B US_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("ControlGroup", "s", NULL, offsetof(Manager, cgroup _root), 0), SD_BUS_PROPERTY("ControlGroup", "s", NULL, offsetof(Manager, cgroup _root), 0),
SD_BUS_PROPERTY("SystemState", "s", property_get_system_state, 0, 0 ), SD_BUS_PROPERTY("SystemState", "s", property_get_system_state, 0, 0 ),
SD_BUS_METHOD("GetUnit", "s", "o", method_get_unit, SD_BUS_VTABLE_U NPRIVILEGED), SD_BUS_METHOD("GetUnit", "s", "o", method_get_unit, SD_BUS_VTABLE_U NPRIVILEGED),
SD_BUS_METHOD("GetUnitByPID", "u", "o", method_get_unit_by_pid, SD_ BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetUnitByPID", "u", "o", method_get_unit_by_pid, SD_ BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("LoadUnit", "s", "o", method_load_unit, SD_BUS_VTABLE _UNPRIVILEGED), SD_BUS_METHOD("LoadUnit", "s", "o", method_load_unit, SD_BUS_VTABLE _UNPRIVILEGED),
SD_BUS_METHOD("StartUnit", "ss", "o", method_start_unit, 0), SD_BUS_METHOD("StartUnit", "ss", "o", method_start_unit, SD_BUS_VTA
SD_BUS_METHOD("StartUnitReplace", "sss", "o", method_start_unit_rep BLE_UNPRIVILEGED),
lace, 0), SD_BUS_METHOD("StartUnitReplace", "sss", "o", method_start_unit_rep
SD_BUS_METHOD("StopUnit", "ss", "o", method_stop_unit, 0), lace, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("ReloadUnit", "ss", "o", method_reload_unit, 0), SD_BUS_METHOD("StopUnit", "ss", "o", method_stop_unit, SD_BUS_VTABL
SD_BUS_METHOD("RestartUnit", "ss", "o", method_restart_unit, 0), E_UNPRIVILEGED),
SD_BUS_METHOD("TryRestartUnit", "ss", "o", method_try_restart_unit, SD_BUS_METHOD("ReloadUnit", "ss", "o", method_reload_unit, SD_BUS_V
0), TABLE_UNPRIVILEGED),
SD_BUS_METHOD("ReloadOrRestartUnit", "ss", "o", method_reload_or_re SD_BUS_METHOD("RestartUnit", "ss", "o", method_restart_unit, SD_BUS
start_unit, 0), _VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("ReloadOrTryRestartUnit", "ss", "o", method_reload_or SD_BUS_METHOD("TryRestartUnit", "ss", "o", method_try_restart_unit,
_try_restart_unit, 0), SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("KillUnit", "ssi", NULL, method_kill_unit, SD_BUS_VTA SD_BUS_METHOD("ReloadOrRestartUnit", "ss", "o", method_reload_or_re
BLE_CAPABILITY(CAP_KILL)), start_unit, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("ResetFailedUnit", "s", NULL, method_reset_failed_uni SD_BUS_METHOD("ReloadOrTryRestartUnit", "ss", "o", method_reload_or
t, 0), _try_restart_unit, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("SetUnitProperties", "sba(sv)", NULL, method_set_unit SD_BUS_METHOD("KillUnit", "ssi", NULL, method_kill_unit, SD_BUS_VTA
_properties, 0), BLE_UNPRIVILEGED),
SD_BUS_METHOD("StartTransientUnit", "ssa(sv)a(sa(sv))", "o", method SD_BUS_METHOD("ResetFailedUnit", "s", NULL, method_reset_failed_uni
_start_transient_unit, 0), t, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("SetUnitProperties", "sba(sv)", NULL, method_set_unit
_properties, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("StartTransientUnit", "ssa(sv)a(sa(sv))", "o", method
_start_transient_unit, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("GetJob", "u", "o", method_get_job, SD_BUS_VTABLE_UNP RIVILEGED), SD_BUS_METHOD("GetJob", "u", "o", method_get_job, SD_BUS_VTABLE_UNP RIVILEGED),
SD_BUS_METHOD("CancelJob", "u", NULL, method_cancel_job, 0), SD_BUS_METHOD("CancelJob", "u", NULL, method_cancel_job, SD_BUS_VTA BLE_UNPRIVILEGED),
SD_BUS_METHOD("ClearJobs", NULL, NULL, method_clear_jobs, 0), SD_BUS_METHOD("ClearJobs", NULL, NULL, method_clear_jobs, 0),
SD_BUS_METHOD("ResetFailed", NULL, NULL, method_reset_failed, 0), SD_BUS_METHOD("ResetFailed", NULL, NULL, method_reset_failed, 0),
SD_BUS_METHOD("ListUnits", NULL, "a(ssssssouso)", method_list_units , SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("ListUnits", NULL, "a(ssssssouso)", method_list_units , SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("ListUnitsFiltered", "as", "a(ssssssouso)", method_li st_units_filtered, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("ListUnitsFiltered", "as", "a(ssssssouso)", method_li st_units_filtered, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("ListJobs", NULL, "a(usssoo)", method_list_jobs, SD_B US_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("ListJobs", NULL, "a(usssoo)", method_list_jobs, SD_B US_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("Subscribe", NULL, NULL, method_subscribe, SD_BUS_VTA BLE_UNPRIVILEGED), SD_BUS_METHOD("Subscribe", NULL, NULL, method_subscribe, SD_BUS_VTA BLE_UNPRIVILEGED),
SD_BUS_METHOD("Unsubscribe", NULL, NULL, method_unsubscribe, SD_BUS _VTABLE_UNPRIVILEGED), SD_BUS_METHOD("Unsubscribe", NULL, NULL, method_unsubscribe, SD_BUS _VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("Dump", NULL, "s", method_dump, SD_BUS_VTABLE_UNPRIVI LEGED), SD_BUS_METHOD("Dump", NULL, "s", method_dump, SD_BUS_VTABLE_UNPRIVI LEGED),
SD_BUS_METHOD("CreateSnapshot", "sb", "o", method_create_snapshot, 0), SD_BUS_METHOD("CreateSnapshot", "sb", "o", method_create_snapshot, 0),
SD_BUS_METHOD("RemoveSnapshot", "s", NULL, method_remove_snapshot, 0), SD_BUS_METHOD("RemoveSnapshot", "s", NULL, method_remove_snapshot, 0),
SD_BUS_METHOD("Reload", NULL, NULL, method_reload, 0), SD_BUS_METHOD("Reload", NULL, NULL, method_reload, SD_BUS_VTABLE_UN
SD_BUS_METHOD("Reexecute", NULL, NULL, method_reexecute, 0), PRIVILEGED),
SD_BUS_METHOD("Reexecute", NULL, NULL, method_reexecute, SD_BUS_VTA
BLE_UNPRIVILEGED),
SD_BUS_METHOD("Exit", NULL, NULL, method_exit, 0), SD_BUS_METHOD("Exit", NULL, NULL, method_exit, 0),
SD_BUS_METHOD("Reboot", NULL, NULL, method_reboot, SD_BUS_VTABLE_CA PABILITY(CAP_SYS_BOOT)), SD_BUS_METHOD("Reboot", NULL, NULL, method_reboot, SD_BUS_VTABLE_CA PABILITY(CAP_SYS_BOOT)),
SD_BUS_METHOD("PowerOff", NULL, NULL, method_poweroff, SD_BUS_VTABL E_CAPABILITY(CAP_SYS_BOOT)), SD_BUS_METHOD("PowerOff", NULL, NULL, method_poweroff, SD_BUS_VTABL E_CAPABILITY(CAP_SYS_BOOT)),
SD_BUS_METHOD("Halt", NULL, NULL, method_halt, SD_BUS_VTABLE_CAPABI LITY(CAP_SYS_BOOT)), SD_BUS_METHOD("Halt", NULL, NULL, method_halt, SD_BUS_VTABLE_CAPABI LITY(CAP_SYS_BOOT)),
SD_BUS_METHOD("KExec", NULL, NULL, method_kexec, SD_BUS_VTABLE_CAPA BILITY(CAP_SYS_BOOT)), SD_BUS_METHOD("KExec", NULL, NULL, method_kexec, SD_BUS_VTABLE_CAPA BILITY(CAP_SYS_BOOT)),
SD_BUS_METHOD("SwitchRoot", "ss", NULL, method_switch_root, SD_BUS_ VTABLE_CAPABILITY(CAP_SYS_BOOT)), SD_BUS_METHOD("SwitchRoot", "ss", NULL, method_switch_root, SD_BUS_ VTABLE_CAPABILITY(CAP_SYS_BOOT)),
SD_BUS_METHOD("SetEnvironment", "as", NULL, method_set_environment, 0), SD_BUS_METHOD("SetEnvironment", "as", NULL, method_set_environment, 0),
SD_BUS_METHOD("UnsetEnvironment", "as", NULL, method_unset_environm ent, 0), SD_BUS_METHOD("UnsetEnvironment", "as", NULL, method_unset_environm ent, 0),
SD_BUS_METHOD("UnsetAndSetEnvironment", "asas", NULL, method_unset_ and_set_environment, 0), SD_BUS_METHOD("UnsetAndSetEnvironment", "asas", NULL, method_unset_ and_set_environment, 0),
SD_BUS_METHOD("ListUnitFiles", NULL, "a(ss)", method_list_unit_file s, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("ListUnitFiles", NULL, "a(ss)", method_list_unit_file s, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("GetUnitFileState", "s", "s", method_get_unit_file_st ate, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetUnitFileState", "s", "s", method_get_unit_file_st ate, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("EnableUnitFiles", "asbb", "ba(sss)", method_enable_u SD_BUS_METHOD("EnableUnitFiles", "asbb", "ba(sss)", method_enable_u
nit_files, 0), nit_files, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("DisableUnitFiles", "asb", "a(sss)", method_disable_u SD_BUS_METHOD("DisableUnitFiles", "asb", "a(sss)", method_disable_u
nit_files, 0), nit_files, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("ReenableUnitFiles", "asbb", "ba(sss)", method_reenab SD_BUS_METHOD("ReenableUnitFiles", "asbb", "ba(sss)", method_reenab
le_unit_files, 0), le_unit_files, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("LinkUnitFiles", "asbb", "a(sss)", method_link_unit_f SD_BUS_METHOD("LinkUnitFiles", "asbb", "a(sss)", method_link_unit_f
iles, 0), iles, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("PresetUnitFiles", "asbb", "ba(sss)", method_preset_u SD_BUS_METHOD("PresetUnitFiles", "asbb", "ba(sss)", method_preset_u
nit_files, 0), nit_files, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("PresetUnitFilesWithMode", "assbb", "ba(sss)", method SD_BUS_METHOD("PresetUnitFilesWithMode", "assbb", "ba(sss)", method
_preset_unit_files_with_mode, 0), _preset_unit_files_with_mode, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("MaskUnitFiles", "asbb", "a(sss)", method_mask_unit_f SD_BUS_METHOD("MaskUnitFiles", "asbb", "a(sss)", method_mask_unit_f
iles, 0), iles, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("UnmaskUnitFiles", "asb", "a(sss)", method_unmask_uni SD_BUS_METHOD("UnmaskUnitFiles", "asb", "a(sss)", method_unmask_uni
t_files, 0), t_files, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("SetDefaultTarget", "sb", "a(sss)", method_set_defaul SD_BUS_METHOD("SetDefaultTarget", "sb", "a(sss)", method_set_defaul
t_target, 0), t_target, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("GetDefaultTarget", NULL, "s", method_get_default_tar get, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetDefaultTarget", NULL, "s", method_get_default_tar get, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD("PresetAllUnitFiles", "sbb", "a(sss)", method_preset_ all_unit_files, 0), SD_BUS_METHOD("PresetAllUnitFiles", "sbb", "a(sss)", method_preset_ all_unit_files, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_SIGNAL("UnitNew", "so", 0), SD_BUS_SIGNAL("UnitNew", "so", 0),
SD_BUS_SIGNAL("UnitRemoved", "so", 0), SD_BUS_SIGNAL("UnitRemoved", "so", 0),
SD_BUS_SIGNAL("JobNew", "uos", 0), SD_BUS_SIGNAL("JobNew", "uos", 0),
SD_BUS_SIGNAL("JobRemoved", "uoss", 0), SD_BUS_SIGNAL("JobRemoved", "uoss", 0),
SD_BUS_SIGNAL("StartupFinished", "tttttt", 0), SD_BUS_SIGNAL("StartupFinished", "tttttt", 0),
SD_BUS_SIGNAL("UnitFilesChanged", NULL, 0), SD_BUS_SIGNAL("UnitFilesChanged", NULL, 0),
SD_BUS_SIGNAL("Reloading", "b", 0), SD_BUS_SIGNAL("Reloading", "b", 0),
SD_BUS_VTABLE_END SD_BUS_VTABLE_END
 End of changes. 32 change blocks. 
49 lines changed or deleted 166 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/