summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-05 04:41:01 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-05 04:41:01 +0100
commit760b9d7cbaa72cc7446ad915f84d4939c11a360c (patch)
treedd9299f52fe360afdc1640b227fab37008660ef3 /src/core/load-fragment.c
parente567439ec6a63f07258d52fe383a538f5dbeb79b (diff)
core: don't override NoNewPriviliges= from SystemCallFilter= if it is already explicitly set
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 5628d8c910..18dab02cd7 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2122,7 +2122,10 @@ int config_parse_syscall_filter(
set_remove(c->syscall_filter, INT_TO_PTR(id + 1));
}
- c->no_new_privileges = true;
+ /* Turn on NNP, but only if it wasn't configured explicitly
+ * before, and only if we are in user mode. */
+ if (!c->no_new_privileges_set && u->manager->running_as == SYSTEMD_USER)
+ c->no_new_privileges = true;
return 0;
}
@@ -2902,6 +2905,38 @@ int config_parse_namespace_path_strv(
return 0;
}
+int config_parse_no_new_priviliges(
+ const char* unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ ExecContext *c = data;
+ int k;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ k = parse_boolean(rvalue);
+ if (k < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, -k, "Failed to parse boolean value, ignoring: %s", rvalue);
+ return 0;
+ }
+
+ c->no_new_privileges = !!k;
+ c->no_new_privileges_set = true;
+
+ return 0;
+}
+
#define FOLLOW_MAX 8
static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {