summaryrefslogtreecommitdiff
path: root/src/core/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-17 16:52:52 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-17 16:52:52 +0100
commit5f8640fb628cb034981e02d741fd9ddf26fdf38d (patch)
treea861f6da5ba7e87cc413683b5e66a4302d17c61a /src/core/load-fragment.c
parent4a3fa6ac77c5236f95963c0a0fdd541d02c6883a (diff)
core: store and expose SELinuxContext field normalized as bool + string
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r--src/core/load-fragment.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index c923874394..2ee4616a1c 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1143,6 +1143,55 @@ int config_parse_exec_mount_flags(const char *unit,
return 0;
}
+int config_parse_exec_selinux_context(
+ 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;
+ Unit *u = userdata;
+ bool ignore;
+ char *k;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ if (isempty(rvalue)) {
+ free(c->selinux_context);
+ c->selinux_context = NULL;
+ c->selinux_context_ignore = false;
+ return 0;
+ }
+
+ if (rvalue[0] == '-') {
+ ignore = true;
+ rvalue++;
+ } else
+ ignore = false;
+
+ r = unit_name_printf(u, rvalue, &k);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, -r, "Failed to resolve specifiers, ignoring: %s", strerror(-r));
+ return 0;
+ }
+
+ free(c->selinux_context);
+ c->selinux_context = k;
+ c->selinux_context_ignore = ignore;
+
+ return 0;
+}
+
int config_parse_timer(const char *unit,
const char *filename,
unsigned line,