chiark / gitweb /
logind: move default reset controller/kill exclude list into logind
authorLennart Poettering <lennart@poettering.net>
Wed, 29 Jun 2011 00:27:16 +0000 (02:27 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 29 Jun 2011 00:27:16 +0000 (02:27 +0200)
src/logind-dbus.c
src/logind.c
src/logind.h
src/pam-module.c

index 69e6b189aaf0a75b33b5c5357abd1c4a342c29da..93525980b79dc3167efb76bf9660dd2a6adf23ca 100644 (file)
@@ -316,7 +316,8 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
         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;
@@ -327,7 +328,8 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
         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;
index 94cb6cd80c70f73ae91e784c20f32117c142c444..28ba58bf5481bab8c29445c1ab957ab143cb4ed7 100644 (file)
@@ -56,7 +56,14 @@ Manager *manager_new(void) {
         m->cgroups = hashmap_new(string_hash_func, string_compare_func);
         m->fifo_fds = hashmap_new(trivial_hash_func, trivial_compare_func);
 
-        if (!m->devices || !m->seats || !m->sessions || !m->users) {
+        if (!m->devices || !m->seats || !m->sessions || !m->users || !m->cgroups || !m->fifo_fds) {
+                manager_free(m);
+                return NULL;
+        }
+
+        m->reset_controllers = strv_new("cpu", NULL);
+        m->kill_exclude_users = strv_new("root", NULL);
+        if (!m->reset_controllers || !m->kill_exclude_users) {
                 manager_free(m);
                 return NULL;
         }
index 8da409bb93b0024d8cd6d4c6f19b6e49ab6814e9..df1364fd729c216cb3bcde90f7f1aeb57323052b 100644 (file)
@@ -36,8 +36,9 @@
  *
  * spawn user systemd
  * direct client API
- * add configuration file
+ * add configuration file man page
  * verify access to SetIdleHint
+ * add FlushDevices bus call
  *
  * udev:
  * drop redundant udev_device_get_is_initialized() use as soon as libudev is fixed
index e1ad8c9bfade571dc1ea020c8bcb2d1c4910dd28..90da898ff84d50bff3dfc031cdba534492489ea1 100644 (file)
@@ -50,8 +50,6 @@ static int parse_argv(pam_handle_t *handle,
                       bool *debug) {
 
         unsigned i;
-        bool reset_controller_set = false;
-        bool kill_exclude_users_set = false;
 
         assert(argc >= 0);
         assert(argc == 0 || argv);
@@ -107,8 +105,6 @@ static int parse_argv(pam_handle_t *handle,
                                 *reset_controllers = l;
                         }
 
-                        reset_controller_set = true;
-
                 } else if (startswith(argv[i], "kill-only-users=")) {
 
                         if (kill_only_users) {
@@ -137,8 +133,6 @@ static int parse_argv(pam_handle_t *handle,
                                 *kill_exclude_users = l;
                         }
 
-                        kill_exclude_users_set = true;
-
                 } else if (startswith(argv[i], "debug=")) {
                         if ((k = parse_boolean(argv[i] + 6)) < 0) {
                                 pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument.");
@@ -159,34 +153,6 @@ static int parse_argv(pam_handle_t *handle,
                 }
         }
 
-        if (!reset_controller_set && reset_controllers) {
-                char **l;
-
-                if (!(l = strv_new("cpu", NULL))) {
-                        pam_syslog(handle, LOG_ERR, "Out of memory");
-                        return -ENOMEM;
-                }
-
-                *reset_controllers = l;
-        }
-
-        if (controllers)
-                strv_remove(*controllers, SYSTEMD_CGROUP_CONTROLLER);
-
-        if (reset_controllers)
-                strv_remove(*reset_controllers, SYSTEMD_CGROUP_CONTROLLER);
-
-        if (!kill_exclude_users_set && kill_exclude_users) {
-                char **l;
-
-                if (!(l = strv_new("root", NULL))) {
-                        pam_syslog(handle, LOG_ERR, "Out of memory");
-                        return -ENOMEM;
-                }
-
-                *kill_exclude_users = l;
-        }
-
         return 0;
 }