2007-03-15 Ralf.Habacker <ralf.habacker@freenet.de>
+ * bus/config-parser.c, bus/policy.c,
+ bus/policy.h, bus/dbus-daemon.1.in,
+ bus/session.conf.in: added eavesdrop support
+ for replies - patch by olli.salli at collabora.co.uk
+ approved by Havoc Pennington.
+
+2007-03-15 Ralf.Habacker <ralf.habacker@freenet.de>
+
* dbus\dbus-sysdeps-win-thread.c: renamed to
dbus-sysdeps-thread-win.c, it is a platform depending file
similar to dbus-sysdeps-pthread.c.
(send_interface && receive_member) ||
(send_interface && receive_error) ||
(send_interface && receive_sender) ||
- (send_interface && eavesdrop) ||
(send_interface && receive_requested_reply) ||
(send_interface && own) ||
(send_interface && user) ||
(send_member && receive_member) ||
(send_member && receive_error) ||
(send_member && receive_sender) ||
- (send_member && eavesdrop) ||
(send_member && receive_requested_reply) ||
(send_member && own) ||
(send_member && user) ||
(send_error && receive_member) ||
(send_error && receive_error) ||
(send_error && receive_sender) ||
- (send_error && eavesdrop) ||
(send_error && receive_requested_reply) ||
(send_error && own) ||
(send_error && user) ||
(send_destination && receive_member) ||
(send_destination && receive_error) ||
(send_destination && receive_sender) ||
- (send_destination && eavesdrop) ||
(send_destination && receive_requested_reply) ||
(send_destination && own) ||
(send_destination && user) ||
(send_type && receive_member) ||
(send_type && receive_error) ||
(send_type && receive_sender) ||
- (send_type && eavesdrop) ||
(send_type && receive_requested_reply) ||
(send_type && own) ||
(send_type && user) ||
(send_path && receive_member) ||
(send_path && receive_error) ||
(send_path && receive_sender) ||
- (send_path && eavesdrop) ||
(send_path && receive_requested_reply) ||
(send_path && own) ||
(send_path && user) ||
(send_requested_reply && receive_member) ||
(send_requested_reply && receive_error) ||
(send_requested_reply && receive_sender) ||
- (send_requested_reply && eavesdrop) ||
(send_requested_reply && receive_requested_reply) ||
(send_requested_reply && own) ||
(send_requested_reply && user) ||
}
}
+ if (eavesdrop &&
+ !(strcmp (eavesdrop, "true") == 0 ||
+ strcmp (eavesdrop, "false") == 0))
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Bad value \"%s\" for %s attribute, must be true or false",
+ "eavesdrop", eavesdrop);
+ return FALSE;
+ }
+
if (send_requested_reply &&
!(strcmp (send_requested_reply, "true") == 0 ||
strcmp (send_requested_reply, "false") == 0))
if (rule == NULL)
goto nomem;
+ if (eavesdrop)
+ rule->d.send.eavesdrop = (strcmp (eavesdrop, "true") == 0);
+
if (send_requested_reply)
rule->d.send.requested_reply = (strcmp (send_requested_reply, "true") == 0);
-
+
rule->d.send.message_type = message_type;
rule->d.send.path = _dbus_strdup (send_path);
rule->d.send.interface = _dbus_strdup (send_interface);
.PP
"Eavesdropping" occurs when an application receives a message that
-was explicitly addressed to a name the application does not own.
-Eavesdropping thus only applies to messages that are addressed to
-services (i.e. it does not apply to signals).
+was explicitly addressed to a name the application does not own, or
+is a reply to such a message. Eavesdropping thus only applies to
+messages that are addressed to services and replies to such messages
+(i.e. it does not apply to signals).
.PP
For <allow>, eavesdrop="true" indicates that the rule matches even
only when eavesdropping. eavesdrop="false" is the default for <deny>
also, but here it means that the rule applies always, even when
not eavesdropping. The eavesdrop attribute can only be combined with
-receive rules (with receive_* attributes).
+send and receive rules (with send_* and receive_* attributes).
.PP
* only when reply was requested. requested_reply=false means
* always allow.
*/
- if (!requested_reply && rule->allow && rule->d.send.requested_reply)
+ if (!requested_reply && rule->allow && rule->d.send.requested_reply && !rule->d.send.eavesdrop)
{
- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies\n");
+ _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n");
continue;
}
* only when reply was requested. requested_reply=false means
* always allow.
*/
- if (!requested_reply && rule->allow && rule->d.receive.requested_reply)
+ if (!requested_reply && rule->allow && rule->d.receive.requested_reply && !rule->d.receive.eavesdrop)
{
- _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies\n");
+ _dbus_verbose (" (policy) skipping allow rule since it only applies to requested replies and does not allow eavesdropping\n");
continue;
}