summaryrefslogtreecommitdiffstats
path: root/src/systemctl/systemctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-10-27 11:33:05 +0200
committerLennart Poettering <lennart@poettering.net>2017-11-17 11:13:44 +0100
commit08f3be7a38d245b5fed9902f10d3129f339477fd (patch)
treeb9b4c8aff09fe77791edae41ef08e2d2dad3933f /src/systemctl/systemctl.c
parentproc-cmdline: minor runlevel_to_target() coding style fixes (diff)
downloadsystemd-08f3be7a38d245b5fed9902f10d3129f339477fd.tar.xz
systemd-08f3be7a38d245b5fed9902f10d3129f339477fd.zip
core: add two new unit file settings: StandardInputData= + StandardInputText=
Both permit configuring data to pass through STDIN to an invoked process. StandardInputText= accepts a line of text (possibly with embedded C-style escapes as well as unit specifiers), which is appended to the buffer to pass as stdin, followed by a single newline. StandardInputData= is similar, but accepts arbitrary base64 encoded data, and will not resolve specifiers or C-style escapes, nor append newlines. This may be used to pass input/configuration data to services, directly in-line from unit files, either in a cooked or in a more raw format.
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r--src/systemctl/systemctl.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 9d9b45f08a..8b701103dc 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -55,6 +55,7 @@
#include "fs-util.h"
#include "glob-util.h"
#include "hostname-util.h"
+#include "hexdecoct.h"
#include "initreq.h"
#include "install.h"
#include "io-util.h"
@@ -4977,6 +4978,24 @@ static int print_property(const char *name, sd_bus_message *m, const char *conte
return bus_log_parse_error(r);
return 0;
+
+ } else if (contents[1] == SD_BUS_TYPE_BYTE && streq(name, "StandardInputData")) {
+ _cleanup_free_ char *h = NULL;
+ const void *p;
+ size_t sz;
+ ssize_t n;
+
+ r = sd_bus_message_read_array(m, 'y', &p, &sz);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ n = base64mem(p, sz, &h);
+ if (n < 0)
+ return log_oom();
+
+ print_prop(name, "%s", h);
+
+ return 0;
}
break;