summaryrefslogtreecommitdiff
path: root/src/core/dbus-execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-22 19:45:32 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-23 03:26:24 +0100
commit9b15b7846d4de01bb5d9700a24077787e984e8ab (patch)
treee42326cf2ae7f03ca72b7f25e0ec738287cc1f46 /src/core/dbus-execute.c
parent91f4347ef7bde17418b365ed3a97a752fe65bd50 (diff)
run: add a new "-t" mode for invoking a binary on an allocated TTY
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r--src/core/dbus-execute.c89
1 files changed, 88 insertions, 1 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index bbcd6106ad..a9f7971cde 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -31,11 +31,12 @@
#include "strv.h"
#include "fileio.h"
#include "execute.h"
-#include "dbus-execute.h"
#include "capability.h"
#include "env-util.h"
#include "af-list.h"
#include "namespace.h"
+#include "path-util.h"
+#include "dbus-execute.h"
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"
@@ -845,6 +846,92 @@ int bus_exec_context_set_transient_property(
return 1;
+ } else if (streq(name, "TTYPath")) {
+ const char *tty;
+
+ r = sd_bus_message_read(message, "s", &tty);
+ if (r < 0)
+ return r;
+
+ if (!path_is_absolute(tty))
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "TTY device not absolute path");
+
+ if (mode != UNIT_CHECK) {
+ char *t;
+
+ t = strdup(tty);
+ if (!t)
+ return -ENOMEM;
+
+ free(c->tty_path);
+ c->tty_path = t;
+
+ unit_write_drop_in_private_format(u, mode, name, "TTYPath=%s\n", tty);
+ }
+
+ return 1;
+
+ } else if (streq(name, "StandardInput")) {
+ const char *s;
+ ExecInput p;
+
+ r = sd_bus_message_read(message, "s", &s);
+ if (r < 0)
+ return r;
+
+ p = exec_input_from_string(s);
+ if (p < 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid standard input name");
+
+ if (mode != UNIT_CHECK) {
+ c->std_input = p;
+
+ unit_write_drop_in_private_format(u, mode, name, "StandardInput=%s\n", exec_input_to_string(p));
+ }
+
+ return 1;
+
+
+ } else if (streq(name, "StandardOutput")) {
+ const char *s;
+ ExecOutput p;
+
+ r = sd_bus_message_read(message, "s", &s);
+ if (r < 0)
+ return r;
+
+ p = exec_output_from_string(s);
+ if (p < 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid standard output name");
+
+ if (mode != UNIT_CHECK) {
+ c->std_output = p;
+
+ unit_write_drop_in_private_format(u, mode, name, "StandardOutput=%s\n", exec_output_to_string(p));
+ }
+
+ return 1;
+
+ } else if (streq(name, "StandardError")) {
+ const char *s;
+ ExecOutput p;
+
+ r = sd_bus_message_read(message, "s", &s);
+ if (r < 0)
+ return r;
+
+ p = exec_output_from_string(s);
+ if (p < 0)
+ return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid standard error name");
+
+ if (mode != UNIT_CHECK) {
+ c->std_error = p;
+
+ unit_write_drop_in_private_format(u, mode, name, "StandardError=%s\n", exec_output_to_string(p));
+ }
+
+ return 1;
+
} else if (streq(name, "Environment")) {
_cleanup_strv_free_ char **l = NULL;