]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
bus/driver: Add basic container info to GetConnectionCredentials()
authorSimon McVittie <smcv@collabora.com>
Fri, 9 Jun 2017 14:58:56 +0000 (15:58 +0100)
committerSimon McVittie <smcv@collabora.com>
Tue, 12 Dec 2017 16:22:34 +0000 (16:22 +0000)
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354

bus/driver.c

index cef1e862404a2ef980d5c855c3850e4a0fa90ba9..ff14ccabf3eb633341e2b5bc1804c891ab5d3e97 100644 (file)
@@ -1915,7 +1915,10 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
   DBusMessageIter array_iter;
   unsigned long ulong_uid, ulong_pid;
   char *s;
+  const char *name;
+  const char *path;
   const char *service;
+  const char *type;
   BusDriverFound found;
 
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
@@ -2003,6 +2006,19 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
       dbus_free (s);
     }
 
+  if (found == BUS_DRIVER_FOUND_PEER &&
+      bus_containers_connection_is_contained (conn, &path, &type, &name))
+    {
+      if (!_dbus_asv_add_object_path (&array_iter,
+                                      DBUS_INTERFACE_CONTAINERS1 ".Instance",
+                                      path) ||
+          !_dbus_asv_add_string (&array_iter,
+                                 DBUS_INTERFACE_CONTAINERS1 ".Type", type) ||
+          !_dbus_asv_add_string (&array_iter,
+                                 DBUS_INTERFACE_CONTAINERS1 ".Name", name))
+        goto oom;
+    }
+
   if (!_dbus_asv_close (&reply_iter, &array_iter))
     goto oom;