Skip to content

dbus-monitor: Don’t send messages after becoming a monitor

Kai Hiller requested to merge V02460/dbus:dispatch_peer_messages into master

“Sending messages on a monitor connection is not allowed” – The Spec

Prevents dbus-monitor from sending messages after it became a monitor by disabling automatic responses to messages with the org.freedesktop.DBus.Peer interface. This is a straight-forward implementation of @smcv’s suggestion.

I had no luck implementing a working unit test starting from this snippet in test/monitor.c and would happily take a hint:

m = dbus_message_new_method_call (NULL, "/",
    "org.freedesktop.DBus.Peer", "Ping");
dbus_connection_send (f->sender, m, NULL);
dbus_message_unref (m);

Fixes #301 (closed).

Merge request reports