summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-03 14:45:37 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-04 17:15:22 +0000
commit1acedfdde7a3b704ed53b58033fd15c6f6b34a3d (patch)
treedd135eb91cb0c95c5ef826ee88aef81a6ad2af4c /bus
parent9fce7380331d24e8dd5fb9203eb8275ebb49e1d8 (diff)
downloaddbus-1acedfdde7a3b704ed53b58033fd15c6f6b34a3d.tar.gz
dbus-1acedfdde7a3b704ed53b58033fd15c6f6b34a3d.tar.bz2
dbus-1acedfdde7a3b704ed53b58033fd15c6f6b34a3d.zip
Capture a fake reply if a broadcast cannot be delivered
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46787 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Diffstat (limited to 'bus')
-rw-r--r--bus/connection.c2
-rw-r--r--bus/connection.h3
-rw-r--r--bus/dispatch.c36
3 files changed, 37 insertions, 4 deletions
diff --git a/bus/connection.c b/bus/connection.c
index 410aaaca..64da1292 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -2180,7 +2180,7 @@ out:
return ret;
}
-static dbus_bool_t
+dbus_bool_t
bus_transaction_capture_error_reply (BusTransaction *transaction,
const DBusError *error,
DBusMessage *in_reply_to)
diff --git a/bus/connection.h b/bus/connection.h
index 280fbf15..dca22633 100644
--- a/bus/connection.h
+++ b/bus/connection.h
@@ -134,6 +134,9 @@ dbus_bool_t bus_transaction_send (BusTransaction *
dbus_bool_t bus_transaction_capture (BusTransaction *transaction,
DBusConnection *connection,
DBusMessage *message);
+dbus_bool_t bus_transaction_capture_error_reply (BusTransaction *transaction,
+ const DBusError *error,
+ DBusMessage *in_reply_to);
dbus_bool_t bus_transaction_send_from_driver (BusTransaction *transaction,
DBusConnection *connection,
DBusMessage *message);
diff --git a/bus/dispatch.c b/bus/dispatch.c
index 630f814c..5cb9d6f4 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -63,17 +63,47 @@ send_one_message (DBusConnection *connection,
BusTransaction *transaction,
DBusError *error)
{
+ DBusError stack_error = DBUS_ERROR_INIT;
+
if (!bus_context_check_security_policy (context, transaction,
sender,
addressed_recipient,
connection,
message,
- NULL))
- return TRUE; /* silently don't send it */
+ &stack_error))
+ {
+ if (!bus_transaction_capture_error_reply (transaction, &stack_error,
+ message))
+ {
+ bus_context_log (context, DBUS_SYSTEM_LOG_WARNING,
+ "broadcast rejected, but not enough "
+ "memory to tell monitors");
+ }
+
+ dbus_error_free (&stack_error);
+ return TRUE; /* don't send it but don't return an error either */
+ }
if (dbus_message_contains_unix_fds(message) &&
!dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
- return TRUE; /* silently don't send it */
+ {
+ dbus_set_error (&stack_error, DBUS_ERROR_NOT_SUPPORTED,
+ "broadcast cannot be delivered to %s (%s) because "
+ "it does not support receiving Unix fds",
+ bus_connection_get_name (connection),
+ bus_connection_get_loginfo (connection));
+
+ if (!bus_transaction_capture_error_reply (transaction, &stack_error,
+ message))
+ {
+ bus_context_log (context, DBUS_SYSTEM_LOG_WARNING,
+ "broadcast with Unix fd not delivered, but not "
+ "enough memory to tell monitors");
+ }
+
+ dbus_error_free (&stack_error);
+ return TRUE; /* don't send it but don't return an error either */
+ }
if (!bus_transaction_send (transaction,
connection,