From 6ce270b10ad5538fb60dabcf409a49a9c5fd0e8d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 21 Nov 2013 20:49:04 +0100 Subject: [PATCH] core: fix deserialization of StartTransientUnit() parameters --- src/core/dbus-manager.c | 4 ++-- src/core/dbus-service.c | 4 ++++ src/core/dbus-unit.c | 11 ++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index bc0c3109e..b284c5e19 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -547,11 +547,11 @@ static int method_start_transient_unit(sd_bus *bus, sd_bus_message *message, voi if (mode < 0) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s is invalid.", smode); - r = manager_load_unit(m, name, NULL, error, &u); + r = selinux_access_check(bus, message, "start", error); if (r < 0) return r; - r = selinux_unit_access_check(u, bus, message, "start", error); + r = manager_load_unit(m, name, NULL, error, &u); if (r < 0) return r; diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index c4bfa2c38..3fa2d3363 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -169,6 +169,10 @@ static int bus_service_set_transient_property( if (r < 0) return r; + r = sd_bus_message_exit_container(message); + if (r < 0) + return r; + if (mode != UNIT_CHECK) { _cleanup_free_ char *buf = NULL; _cleanup_fclose_ FILE *f = NULL; diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 5fca7653e..975fc4628 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -780,7 +780,7 @@ int bus_unit_queue_job( path = job_dbus_path(j); if (!path) - return r; + return -ENOMEM; return sd_bus_reply_method_return(message, "o", path); } @@ -895,6 +895,10 @@ static int bus_unit_set_transient_property( if (r < 0) return r; + r = sd_bus_message_exit_container(message); + if (r < 0) + return r; + return 1; } @@ -941,6 +945,7 @@ int bus_unit_set_properties( r = sd_bus_message_rewind(message, false); if (r < 0) return r; + for_real = true; continue; } @@ -975,6 +980,10 @@ int bus_unit_set_properties( n += for_real; } + r = sd_bus_message_exit_container(message); + if (r < 0) + return r; + if (commit && n > 0 && UNIT_VTABLE(u)->bus_commit_properties) UNIT_VTABLE(u)->bus_commit_properties(u); -- 2.30.2