From 89f70b19495e9c3dadbbb7b51ce1629fa22ea3af Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 21 May 2009 01:00:52 +0200 Subject: 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. --- bus/dispatch.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'bus') 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)) -- cgit