load-fragment: allow to specify RestrictNamespaces= multiple times

If multiple RestrictNamespaces= settings are set, then merge the settings.
This also drops supporting "~yes" and "~no".
This commit is contained in:
Yu Watanabe
2018-05-05 11:07:37 +09:00
parent 86c2a9f1c2
commit aa9d574de9
4 changed files with 32 additions and 22 deletions
+6 -6
View File
@@ -1003,12 +1003,7 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
if (streq(field, "RestrictNamespaces")) {
bool invert = false;
unsigned long flags = 0;
if (eq[0] == '~') {
invert = true;
eq++;
}
unsigned long flags;
r = parse_boolean(eq);
if (r > 0)
@@ -1016,6 +1011,11 @@ static int bus_append_execute_property(sd_bus_message *m, const char *field, con
else if (r == 0)
flags = NAMESPACE_FLAGS_ALL;
else {
if (eq[0] == '~') {
invert = true;
eq++;
}
r = namespace_flags_from_string(eq, &flags);
if (r < 0)
return log_error_errno(r, "Failed to parse %s value %s.", field, eq);
+2
View File
@@ -24,6 +24,8 @@
CLONE_NEWUSER| \
CLONE_NEWUTS))
#define NAMESPACE_FLAGS_INITIAL ((unsigned long) -1)
int namespace_flags_from_string(const char *name, unsigned long *ret);
int namespace_flags_to_string(unsigned long flags, char **ret);