summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/bus-internal.h1
-rw-r--r--src/libsystemd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd-bus/bus-socket.c1
-rw-r--r--src/libsystemd-bus/sd-bus.c10
4 files changed, 9 insertions, 4 deletions
diff --git a/src/libsystemd-bus/bus-internal.h b/src/libsystemd-bus/bus-internal.h
index 1be7488ab9..df9a0b571c 100644
--- a/src/libsystemd-bus/bus-internal.h
+++ b/src/libsystemd-bus/bus-internal.h
@@ -147,6 +147,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;
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index c5817a78d6..68d0f48bd0 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -363,6 +363,7 @@ int bus_kernel_take_fd(sd_bus *b) {
b->bus_client = true;
b->can_fds = !!(hello.conn_flags & KDBUS_HELLO_ACCEPT_FD);
b->message_version = 2;
+ b->message_endian = BUS_NATIVE_ENDIAN;
/* the kernel told us the UUID of the underlying bus */
memcpy(b->server_id.bytes, hello.id128, sizeof(b->server_id.bytes));
diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c
index a449ce0eb3..1365092d73 100644
--- a/src/libsystemd-bus/bus-socket.c
+++ b/src/libsystemd-bus/bus-socket.c
@@ -625,6 +625,7 @@ int bus_socket_setup(sd_bus *b) {
b->is_kernel = false;
b->message_version = 1;
+ b->message_endian = 0;
return 0;
}
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 37408cf7b4..1a60356311 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1280,7 +1280,12 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m) {
assert(b);
assert(m);
- if (m->header->version > b->message_version)
+ if (b->message_version != 0 &&
+ m->header->version != b->message_version)
+ return -EPERM;
+
+ if (b->message_endian != 0 &&
+ m->header->endian != b->message_endian)
return -EPERM;
if (m->sealed) {
@@ -1298,9 +1303,6 @@ int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) {
assert(b);
assert(m);
- if (m->header->version > b->message_version)
- return -EPERM;
-
/* The bus specification says the serial number cannot be 0,
* hence let's fill something in for synthetic messages. Since
* synthetic messages might have a fake sender and we don't