if (STR_IN_SET(field, "RestrictNamespaces",
"DelegateNamespaces")) {
bool invert = false;
+ unsigned long all = UPDATE_FLAG(NAMESPACE_FLAGS_ALL, CLONE_NEWUSER, !streq(field, "DelegateNamespaces"));
unsigned long flags;
r = parse_boolean(eq);
if (r > 0)
- flags = 0;
+ /* RestrictNamespaces= value gets stored into a field with reverse semantics (the
+ * namespaces which are retained), so RestrictNamespaces=true means we retain no
+ * access to any namespaces and vice-versa. */
+ flags = streq(field, "RestrictNamespaces") ? 0 : all;
else if (r == 0)
- flags = NAMESPACE_FLAGS_ALL;
+ flags = streq(field, "RestrictNamespaces") ? all : 0;
else {
if (eq[0] == '~') {
invert = true;
}
if (invert)
- flags = (~flags) & NAMESPACE_FLAGS_ALL;
+ flags = (~flags) & all;
r = sd_bus_message_append(m, "(sv)", field, "t", (uint64_t) flags);
if (r < 0)