summaryrefslogtreecommitdiff
path: root/src/shared/env-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-02-11 23:41:15 +0100
committerLennart Poettering <lennart@poettering.net>2013-02-11 23:54:30 +0100
commit123b964a537c21e9ebaf849acefb23f0f13db785 (patch)
tree09738b2edf39e704cf8ef44d1287a26667978cb4 /src/shared/env-util.c
parentabb381b3b3a169a0cd6015c02f21f6032a78a873 (diff)
manager: validate environment parameters for SetEnvironment(), UnsetEnvironment() bus calls
Diffstat (limited to 'src/shared/env-util.c')
-rw-r--r--src/shared/env-util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index 7a213a77c0..9a833d22e4 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -135,6 +135,21 @@ bool strv_env_is_valid(char **e) {
return true;
}
+bool strv_env_name_or_assignment_is_valid(char **l) {
+ char **p, **q;
+
+ STRV_FOREACH(p, l) {
+ if (!env_assignment_is_valid(*p) && !env_name_is_valid(*p))
+ return false;
+
+ STRV_FOREACH(q, p + 1)
+ if (streq(*p, *q))
+ return false;
+ }
+
+ return true;
+}
+
static int env_append(char **r, char ***k, char **a) {
assert(r);
assert(k);