chiark / gitweb /
logind: include "self" object links in dbus introspection
[elogind.git] / src / login / logind-session-dbus.c
index fc728bb..a6b15f2 100644 (file)
 
 #include <errno.h>
 #include <string.h>
-#include <sys/capability.h>
 
 #include "util.h"
 #include "strv.h"
 #include "bus-util.h"
-#include "bus-errors.h"
+#include "bus-common-errors.h"
+#include "bus-label.h"
 
 #include "logind.h"
 #include "logind-session.h"
@@ -248,7 +248,7 @@ static int method_set_idle_hint(sd_bus *bus, sd_bus_message *message, void *user
                 return r;
 
         if (uid != 0 && uid != s->user->uid)
-                return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session my set idle hint");
+                return sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "Only owner of session may set idle hint");
 
         session_set_idle_hint(s, b);
 
@@ -492,7 +492,7 @@ int session_object_find(sd_bus *bus, const char *path, const char *interface, vo
                 sd_bus_message *message;
                 pid_t pid;
 
-                message = sd_bus_get_current(bus);
+                message = sd_bus_get_current_message(bus);
                 if (!message)
                         return 0;
 
@@ -515,7 +515,7 @@ int session_object_find(sd_bus *bus, const char *path, const char *interface, vo
                 if (!p)
                         return 0;
 
-                e = sd_bus_label_unescape(p);
+                e = bus_label_unescape(p);
                 if (!e)
                         return -ENOMEM;
 
@@ -533,7 +533,7 @@ char *session_bus_path(Session *s) {
 
         assert(s);
 
-        t = sd_bus_label_escape(s->id);
+        t = bus_label_escape(s->id);
         if (!t)
                 return NULL;
 
@@ -563,6 +563,10 @@ int session_node_enumerator(sd_bus *bus, const char *path, void *userdata, char
                         return r;
         }
 
+        r = strv_extend(&l, "/org/freedesktop/login1/session/self");
+        if (r < 0)
+                return r;
+
         *nodes = l;
         l = NULL;
 
@@ -675,9 +679,11 @@ int session_send_create_reply(Session *s, sd_bus_error *error) {
                 return -ENOMEM;
 
         log_debug("Sending reply about created session: "
-                  "id=%s object_path=%s runtime_path=%s session_fd=%d seat=%s vtnr=%u",
+                  "id=%s object_path=%s uid=%u runtime_path=%s "
+                  "session_fd=%d seat=%s vtnr=%u",
                   s->id,
                   p,
+                  (uint32_t) s->user->uid,
                   s->user->runtime_path,
                   fifo_fd,
                   s->seat ? s->seat->id : "",