|
|
a4b143 |
From 86ccda12838942a4df2c974bad9386a60835ba67 Mon Sep 17 00:00:00 2001
|
|
|
a4b143 |
From: Lennart Poettering <lennart@poettering.net>
|
|
|
a4b143 |
Date: Fri, 27 Sep 2013 00:11:54 +0200
|
|
|
a4b143 |
Subject: [PATCH] systemctl: make sure set-property mangles unit names
|
|
|
a4b143 |
|
|
|
a4b143 |
---
|
|
|
a4b143 |
src/systemctl/systemctl.c | 9 +++++++--
|
|
|
a4b143 |
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
a4b143 |
|
|
|
a4b143 |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
|
a4b143 |
index 57e5bb9..16da293 100644
|
|
|
a4b143 |
--- a/src/systemctl/systemctl.c
|
|
|
a4b143 |
+++ b/src/systemctl/systemctl.c
|
|
|
a4b143 |
@@ -3828,7 +3828,8 @@ static int append_assignment(DBusMessageIter *iter, const char *assignment) {
|
|
|
a4b143 |
|
|
|
a4b143 |
static int set_property(DBusConnection *bus, char **args) {
|
|
|
a4b143 |
|
|
|
a4b143 |
- _cleanup_free_ DBusMessage *m = NULL, *reply = NULL;
|
|
|
a4b143 |
+ _cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL;
|
|
|
a4b143 |
+ _cleanup_free_ char *n = NULL;
|
|
|
a4b143 |
DBusMessageIter iter, sub;
|
|
|
a4b143 |
dbus_bool_t runtime;
|
|
|
a4b143 |
DBusError error;
|
|
|
a4b143 |
@@ -3849,7 +3850,11 @@ static int set_property(DBusConnection *bus, char **args) {
|
|
|
a4b143 |
|
|
|
a4b143 |
runtime = arg_runtime;
|
|
|
a4b143 |
|
|
|
a4b143 |
- if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &args[1]) ||
|
|
|
a4b143 |
+ n = unit_name_mangle(args[1]);
|
|
|
a4b143 |
+ if (!n)
|
|
|
a4b143 |
+ return log_oom();
|
|
|
a4b143 |
+
|
|
|
a4b143 |
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &n) ||
|
|
|
a4b143 |
!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &runtime) ||
|
|
|
a4b143 |
!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(sv)", &sub))
|
|
|
a4b143 |
return log_oom();
|