summaryrefslogtreecommitdiffstats
path: root/bus/bus.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-10-10 02:42:21 +0000
committerHavoc Pennington <hp@redhat.com>2003-10-10 02:42:21 +0000
commit6a65f4802e95ba442c520f8e225da837e0a9f73b (patch)
tree734e69da90869b3788d381e75911d720ad8cfd0f /bus/bus.c
parent79d03f94fec278d270a33792aeffb33ba239bb01 (diff)
2003-10-09 Havoc Pennington <hp@redhat.com>
Make matching rules theoretically work (add parser). * bus/bus.c (bus_context_check_security_policy): fix up to handle the case where destination is explicitly specified as bus driver and someone else is eavesdropping. * bus/policy.c (bus_client_policy_check_can_receive): fix up definition of eavesdropping and assertion * tools/dbus-send.c (main): use dbus_message_type_from_string * bus/signals.c (bus_match_rule_parse): implement * dbus/dbus-message.c (dbus_message_type_from_string): new * dbus/dbus-errors.h (DBUS_ERROR_MATCH_RULE_INVALID): add
Diffstat (limited to 'bus/bus.c')
-rw-r--r--bus/bus.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/bus/bus.c b/bus/bus.c
index 4087334e..d649199e 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -872,6 +872,19 @@ bus_context_get_max_match_rules_per_connection (BusContext *context)
return context->limits.max_match_rules_per_connection;
}
+/*
+ * addressed_recipient is the recipient specified in the message.
+ *
+ * proposed_recipient is the recipient we're considering sending
+ * to right this second, and may be an eavesdropper.
+ *
+ * sender is the sender of the message.
+ *
+ * NULL for proposed_recipient or sender definitely means the bus driver.
+ *
+ * NULL for addressed_recipient may mean the bus driver, or may mean
+ * no destination was specified in the message (e.g. a signal).
+ */
dbus_bool_t
bus_context_check_security_policy (BusContext *context,
DBusConnection *sender,
@@ -883,15 +896,9 @@ bus_context_check_security_policy (BusContext *context,
BusClientPolicy *sender_policy;
BusClientPolicy *recipient_policy;
- /* NULL sender, proposed_recipient means the bus driver. NULL
- * addressed_recipient means the message didn't specify an explicit
- * target. If proposed_recipient is NULL, then addressed_recipient
- * is also NULL but is implicitly the bus driver.
- */
-
- _dbus_assert (proposed_recipient == NULL ||
- (dbus_message_get_destination (message) == NULL ||
- addressed_recipient != NULL));
+ _dbus_assert (dbus_message_get_destination (message) == NULL || /* Signal */
+ (addressed_recipient != NULL ||
+ strcmp (dbus_message_get_destination (message), DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) == 0)); /* Destination specified or is the bus driver */
if (sender != NULL)
{