summaryrefslogtreecommitdiffstats
path: root/bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-05-21 01:00:52 +0200
committerLennart Poettering <lennart@poettering.net>2009-05-21 01:21:35 +0200
commit89f70b19495e9c3dadbbb7b51ce1629fa22ea3af (patch)
tree404dabfc98634a6aa025f6d74b432cff49e60e14 /bus
parent724adb2f61bd8a6ea41932e04df9303d0a1eed18 (diff)
bus: don't forward messages with unix fds on connections that don't support it
This simply verifies that we forward unix fds only on connection that support it. We willr eturn an error if a client attempts to send a message with unix fds to another client that cannot do it.
Diffstat (limited to 'bus')
-rw-r--r--bus/dispatch.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/bus/dispatch.c b/bus/dispatch.c
index 8ed88dad..fa5874d2 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -56,6 +56,10 @@ send_one_message (DBusConnection *connection,
message,
NULL))
return TRUE; /* silently don't send it */
+
+ if (dbus_message_contains_unix_fds(message) &&
+ !dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
+ return TRUE; /* silently don't send it */
if (!bus_transaction_send (transaction,
connection,
@@ -300,6 +304,16 @@ bus_dispatch (DBusConnection *connection,
addressed_recipient,
message, &error))
goto out;
+
+ if (dbus_message_contains_unix_fds(message) &&
+ !dbus_connection_can_send_type(addressed_recipient, DBUS_TYPE_UNIX_FD))
+ {
+ dbus_set_error(&error,
+ DBUS_ERROR_NOT_SUPPORTED,
+ "Tried to send message with Unix file descriptors"
+ "to a client that doesn't support that.");
+ goto out;
+ }
/* Dispatch the message */
if (!bus_transaction_send (transaction, addressed_recipient, message))