chiark / gitweb /
cgroup: certain cgroup attributes are not available in the root cgroup, hence don...
[elogind.git] / src / core / dbus-cgroup.c
index 792f37eef588e8ac5add4d38283b5fc2dc7b57a5..775825bee912edd6bef66b878c1e52e907313b85 100644 (file)
@@ -278,6 +278,10 @@ int bus_cgroup_set_property(
                 if (r < 0)
                         return r;
 
+                r = sd_bus_message_exit_container(message);
+                if (r < 0)
+                        return r;
+
                 if (mode != UNIT_CHECK) {
                         CGroupBlockIODeviceBandwidth *a, *next;
                         _cleanup_free_ char *buf = NULL;
@@ -356,6 +360,10 @@ int bus_cgroup_set_property(
                         n++;
                 }
 
+                r = sd_bus_message_exit_container(message);
+                if (r < 0)
+                        return r;
+
                 if (mode != UNIT_CHECK) {
                         _cleanup_free_ char *buf = NULL;
                         _cleanup_fclose_ FILE *f = NULL;
@@ -442,8 +450,11 @@ int bus_cgroup_set_property(
 
                 while ((r = sd_bus_message_read(message, "(ss)", &path, &rwm)) > 0) {
 
-                        if (!path_startswith(path, "/dev"))
-                                return sd_bus_error_set_errnof(error, EINVAL, "DeviceAllow= requires device node");
+                        if ((!startswith(path, "/dev/") &&
+                             !startswith(path, "block-") &&
+                             !startswith(path, "char-")) ||
+                            strpbrk(path, WHITESPACE))
+                            return sd_bus_error_set_errnof(error, EINVAL, "DeviceAllow= requires device node");
 
                         if (isempty(rwm))
                                 rwm = "rwm";
@@ -478,7 +489,6 @@ int bus_cgroup_set_property(
                                 a->r = !!strchr(rwm, 'r');
                                 a->w = !!strchr(rwm, 'w');
                                 a->m = !!strchr(rwm, 'm');
-
                         }
 
                         n++;
@@ -486,6 +496,10 @@ int bus_cgroup_set_property(
                 if (r < 0)
                         return r;
 
+                r = sd_bus_message_exit_container(message);
+                if (r < 0)
+                        return r;
+
                 if (mode != UNIT_CHECK) {
                         _cleanup_free_ char *buf = NULL;
                         _cleanup_fclose_ FILE *f = NULL;