chiark / gitweb /
man: add sd-login(7) page
[elogind.git] / src / logind-dbus.c
index 035847c622e740bcd18d473851969920fedd708b..0550d1bd1cc6b29ebe698c6d3e0a4644ed292d89 100644 (file)
@@ -72,6 +72,8 @@
         "   <arg name=\"path\" type=\"o\" direction=\"out\"/>\n"        \
         "   <arg name=\"runtime_path\" type=\"o\" direction=\"out\"/>\n" \
         "   <arg name=\"fd\" type=\"h\" direction=\"out\"/>\n"          \
+        "   <arg name=\"seat\" type=\"s\" direction=\"out\"/>\n"        \
+        "   <arg name=\"vtnr\" type=\"u\" direction=\"out\"/>\n"        \
         "  </method>\n"                                                 \
         "  <method name=\"ActivateSession\">\n"                         \
         "   <arg name=\"id\" type=\"s\" direction=\"in\"/>\n"           \
@@ -379,6 +381,7 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
                 session = hashmap_get(m->sessions, id);
 
                 if (session) {
+                        free(id);
 
                         fifo_fd = session_create_fifo(session);
                         if (fifo_fd < 0) {
@@ -402,12 +405,16 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
                                 goto fail;
                         }
 
+                        seat = session->seat ? session->seat->id : "";
+                        vtnr = session->vtnr;
                         b = dbus_message_append_args(
                                         reply,
                                         DBUS_TYPE_STRING, &session->id,
                                         DBUS_TYPE_OBJECT_PATH, &p,
                                         DBUS_TYPE_STRING, &session->user->runtime_path,
                                         DBUS_TYPE_UNIX_FD, &fifo_fd,
+                                        DBUS_TYPE_STRING, &seat,
+                                        DBUS_TYPE_UINT32, &vtnr,
                                         DBUS_TYPE_INVALID);
                         free(p);
 
@@ -419,6 +426,9 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
                         close_nointr_nofail(fifo_fd);
                         *_reply = reply;
 
+                        strv_free(controllers);
+                        strv_free(reset_controllers);
+
                         return 0;
                 }
 
@@ -519,12 +529,15 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
                 goto fail;
         }
 
+        seat = s ? s->id : "";
         b = dbus_message_append_args(
                         reply,
                         DBUS_TYPE_STRING, &session->id,
                         DBUS_TYPE_OBJECT_PATH, &p,
                         DBUS_TYPE_STRING, &session->user->runtime_path,
                         DBUS_TYPE_UNIX_FD, &fifo_fd,
+                        DBUS_TYPE_STRING, &seat,
+                        DBUS_TYPE_UINT32, &vtnr,
                         DBUS_TYPE_INVALID);
         free(p);
 
@@ -960,8 +973,11 @@ static DBusHandlerResult manager_message_handler(
         } else if (dbus_message_is_method_call(message, "org.freedesktop.login1.Manager", "CreateSession")) {
 
                 r = bus_manager_create_session(m, message, &reply);
-                if (r == -ENOMEM)
-                        goto oom;
+
+                /* Don't delay the work on OOM here, since it might be
+                 * triggered by a low RLIMIT_NOFILE here (since we
+                 * send a dupped fd to the client), and we'd rather
+                 * see this fail quickly then be retried later */
 
                 if (r < 0)
                         return bus_send_error_reply(connection, message, &error, r);