int r;
char *id = NULL, *p;
uint32_t vtnr = 0;
- int pipe_fds[2] = { -1, -1 };
+ int fifo_fd = -1;
DBusMessage *reply = NULL;
bool b;
if (r < 0)
return -EINVAL;
- if (!dbus_message_iter_next(&iter) ||
+ if (strv_contains(controllers, "systemd") ||
+ !dbus_message_iter_next(&iter) ||
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_STRING) {
r = -EINVAL;
if (r < 0)
goto fail;
- if (!dbus_message_iter_next(&iter) ||
+ if (strv_contains(reset_controllers, "systemd") ||
+ !dbus_message_iter_next(&iter) ||
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_BOOLEAN) {
r = -EINVAL;
goto fail;
if (session) {
+ fifo_fd = session_create_fifo(session);
+ if (fifo_fd < 0) {
+ r = fifo_fd;
+ goto fail;
+ }
+
/* Session already exists, client is probably
* something like "su" which changes uid but
* is still the same audit session */
goto fail;
}
- /* Create a throw-away fd */
- if (pipe(pipe_fds) < 0) {
- r = -errno;
- goto fail;
- }
-
- close_nointr_nofail(pipe_fds[0]);
- pipe_fds[0] = -1;
-
p = session_bus_path(session);
if (!p) {
r = -ENOMEM;
DBUS_TYPE_STRING, &session->id,
DBUS_TYPE_OBJECT_PATH, &p,
DBUS_TYPE_STRING, &session->user->runtime_path,
- DBUS_TYPE_UNIX_FD, &pipe_fds[1],
+ DBUS_TYPE_UNIX_FD, &fifo_fd,
DBUS_TYPE_INVALID);
free(p);
goto fail;
}
- close_nointr_nofail(pipe_fds[1]);
+ close_nointr_nofail(fifo_fd);
*_reply = reply;
return 0;
}
}
- if (pipe(pipe_fds) < 0) {
- r = -errno;
+ fifo_fd = session_create_fifo(session);
+ if (fifo_fd < 0) {
+ r = fifo_fd;
goto fail;
}
- r = session_set_pipe_fd(session, pipe_fds[0]);
- if (r < 0)
- goto fail;
- pipe_fds[0] = -1;
-
if (s) {
r = seat_attach_session(s, session);
if (r < 0)
DBUS_TYPE_STRING, &session->id,
DBUS_TYPE_OBJECT_PATH, &p,
DBUS_TYPE_STRING, &session->user->runtime_path,
- DBUS_TYPE_UNIX_FD, &pipe_fds[1],
+ DBUS_TYPE_UNIX_FD, &fifo_fd,
DBUS_TYPE_INVALID);
free(p);
goto fail;
}
- close_nointr_nofail(pipe_fds[1]);
+ close_nointr_nofail(fifo_fd);
*_reply = reply;
return 0;
if (user)
user_add_to_gc_queue(user);
- close_pipe(pipe_fds);
+ if (fifo_fd >= 0)
+ close_nointr_nofail(fifo_fd);
if (reply)
dbus_message_unref(reply);
char *rule = NULL, *file = NULL;
const char *id_for_seat;
int r;
+ struct udev_enumerate *e;
+ struct udev_list_entry *first, *item;
assert(m);
assert(seat);
mkdir_p("/etc/udev/rules.d", 0755);
r = write_one_line_file(file, rule);
+ if (r < 0)
+ goto finish;
+
+ e = udev_enumerate_new(m->udev);
+ if (!e) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ if (udev_enumerate_scan_devices(e) < 0) {
+ r = -EIO;
+ goto finish;
+ }
+
+ first = udev_enumerate_get_list_entry(e);
+ udev_list_entry_foreach(item, first) {
+ char *t;
+ const char *p;
+
+ p = udev_list_entry_get_name(item);
+ if (!path_startswith(p, sysfs))
+ continue;
+
+ t = strappend(p, "/uevent");
+ if (!t) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ write_one_line_file(t, "change");
+ free(t);
+ }
finish:
free(rule);
if (d)
udev_device_unref(d);
+ if (e)
+ udev_enumerate_unref(e);
+
return r;
}
const BusProperty properties[] = {
{ "org.freedesktop.login1.Manager", "ControlGroupHierarchy", bus_property_append_string, "s", m->cgroup_path },
{ "org.freedesktop.login1.Manager", "Controllers", bus_property_append_strv, "as", m->controllers },
+ { "org.freedesktop.login1.Manager", "ResetControllers", bus_property_append_strv, "as", m->reset_controllers },
{ "org.freedesktop.login1.Manager", "NAutoVTs", bus_property_append_unsigned, "u", &m->n_autovts },
{ "org.freedesktop.login1.Manager", "KillOnlyUsers", bus_property_append_strv, "as", m->kill_only_users },
{ "org.freedesktop.login1.Manager", "KillExcludeUsers", bus_property_append_strv, "as", m->kill_exclude_users },