summaryrefslogtreecommitdiff
path: root/src/shared/bus-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-11 18:46:15 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-11 18:46:15 +0100
commita1350640ba605cf5876b25abfee886488a33e50b (patch)
treec0e4c0d255fe99cf7d79e1cde128915de986db3d /src/shared/bus-util.c
parent3116c225d2e3c0d8e6b3f4d4a9b48443cc7baf2d (diff)
parente1abca2ee42e5938ee1f2542c3eba9e70edb0be2 (diff)
Merge pull request #1852 from filbranden/passenv6
execute: Add new PassEnvironment= directive (v4)
Diffstat (limited to 'src/shared/bus-util.c')
-rw-r--r--src/shared/bus-util.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index a13991a960..73ceeba18f 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -1654,7 +1654,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
r = sd_bus_message_append(m, "v", "i", i);
- } else if (streq(field, "Environment")) {
+ } else if (STR_IN_SET(field, "Environment", "PassEnvironment")) {
const char *p;
r = sd_bus_message_open_container(m, 'v', "as");
@@ -1678,9 +1678,16 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
if (r == 0)
break;
- if (!env_assignment_is_valid(word)) {
- log_error("Invalid environment assignment: %s", eq);
- return -EINVAL;
+ if (streq(field, "Environment")) {
+ if (!env_assignment_is_valid(word)) {
+ log_error("Invalid environment assignment: %s", word);
+ return -EINVAL;
+ }
+ } else { /* PassEnvironment */
+ if (!env_name_is_valid(word)) {
+ log_error("Invalid environment variable name: %s", word);
+ return -EINVAL;
+ }
}
r = sd_bus_message_append_basic(m, 's', word);