chiark / gitweb /
bus: fake client side creds in the proxy to the caller's creds
[elogind.git] / src / libsystemd-bus / bus-internal.h
index 4af5526..673f30e 100644 (file)
@@ -36,6 +36,7 @@
 #include "bus-error.h"
 #include "bus-match.h"
 #include "bus-kernel.h"
+#include "kdbus.h"
 
 struct reply_callback {
         sd_bus_message_handler_t callback;
@@ -147,6 +148,7 @@ struct sd_bus {
         enum bus_state state;
         int input_fd, output_fd;
         int message_version;
+        int message_endian;
 
         bool is_kernel:1;
         bool can_fds:1;
@@ -159,6 +161,8 @@ struct sd_bus {
         bool match_callbacks_modified:1;
         bool filter_callbacks_modified:1;
         bool nodes_modified:1;
+        bool trusted:1;
+        bool fake_creds_valid:1;
 
         int use_memfd;
 
@@ -167,14 +171,17 @@ struct sd_bus {
 
         sd_bus_message **rqueue;
         unsigned rqueue_size;
+        size_t rqueue_allocated;
 
         sd_bus_message **wqueue;
         unsigned wqueue_size;
         size_t windex;
+        size_t wqueue_allocated;
 
         uint64_t serial;
 
         char *unique_name;
+        uint64_t unique_id;
 
         struct bus_match_node match_callbacks;
         Prioq *reply_callbacks_prioq;
@@ -182,8 +189,6 @@ struct sd_bus {
         LIST_HEAD(struct filter_callback, filter_callbacks);
 
         Hashmap *nodes;
-
-
         Hashmap *vtable_methods;
         Hashmap *vtable_properties;
 
@@ -215,6 +220,8 @@ struct sd_bus {
         struct ucred ucred;
         char label[NAME_MAX];
 
+        uint64_t creds_mask;
+
         int *fds;
         unsigned n_fds;
 
@@ -239,6 +246,7 @@ struct sd_bus {
         pid_t original_pid;
 
         uint64_t hello_flags;
+        uint64_t attach_flags;
 
         uint64_t match_cookie;
 
@@ -247,11 +255,15 @@ struct sd_bus {
         sd_event_source *time_event_source;
         sd_event_source *quit_event_source;
         sd_event *event;
+        int event_priority;
 
         sd_bus_message *current;
 
         sd_bus **default_bus_ptr;
         pid_t tid;
+
+        struct kdbus_creds fake_creds;
+        char *fake_label;
 };
 
 #define BUS_DEFAULT_TIMEOUT ((usec_t) (25 * USEC_PER_SEC))
@@ -293,6 +305,10 @@ int bus_ensure_running(sd_bus *bus);
 int bus_start_running(sd_bus *bus);
 int bus_next_address(sd_bus *bus);
 
+int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m);
+
+int bus_rqueue_make_room(sd_bus *bus);
+
 bool bus_pid_changed(sd_bus *bus);
 
 char *bus_address_escape(const char *v);