mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 16:58:00 +02:00
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>
This commit is contained in:
parent
9fce738033
commit
1acedfdde7
3 changed files with 37 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue