dbus/bus config-parser.c, 1.48, 1.49 dbus-daemon.1.in, 1.7, 1.8 policy.c, 1.24, 1.25 policy.h, 1.17, 1.18 session.conf.in, 1.12, 1.13

Ralf Habacker rhabacker at kemper.freedesktop.org
Thu Mar 15 06:27:03 PDT 2007


Update of /cvs/dbus/dbus/bus
In directory kemper:/tmp/cvs-serv19763/bus

Modified Files:
	config-parser.c dbus-daemon.1.in policy.c policy.h 
	session.conf.in 
Log Message:
* 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.

Index: config-parser.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/config-parser.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- config-parser.c	12 Mar 2007 22:52:39 -0000	1.48
+++ config-parser.c	15 Mar 2007 13:27:01 -0000	1.49
@@ -1181,7 +1181,6 @@
        (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) ||
@@ -1192,7 +1191,6 @@
        (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) ||
@@ -1202,7 +1200,6 @@
        (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) ||
@@ -1212,7 +1209,6 @@
        (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) ||
@@ -1222,7 +1218,6 @@
        (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) ||
@@ -1232,7 +1227,6 @@
        (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) ||
@@ -1242,7 +1236,6 @@
        (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) ||
@@ -1319,6 +1312,16 @@
             }
         }
 
+      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))
@@ -1333,9 +1336,12 @@
       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);

Index: dbus-daemon.1.in
===================================================================
RCS file: /cvs/dbus/dbus/bus/dbus-daemon.1.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dbus-daemon.1.in	10 Mar 2007 08:04:39 -0000	1.7
+++ dbus-daemon.1.in	15 Mar 2007 13:27:01 -0000	1.8
@@ -437,9 +437,10 @@
 
 .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 
@@ -449,7 +450,7 @@
 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

Index: policy.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/policy.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- policy.c	12 Dec 2006 21:24:07 -0000	1.24
+++ policy.c	15 Mar 2007 13:27:01 -0000	1.25
@@ -900,9 +900,9 @@
            * 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;
             }
 
@@ -1086,9 +1086,9 @@
            * 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;
             }
 

Index: policy.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/policy.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- policy.h	12 Dec 2006 21:24:07 -0000	1.17
+++ policy.h	15 Mar 2007 13:27:01 -0000	1.18
@@ -63,6 +63,7 @@
       char *member;
       char *error;
       char *destination;
+      unsigned int eavesdrop : 1;
       unsigned int requested_reply : 1;
     } send;
 

Index: session.conf.in
===================================================================
RCS file: /cvs/dbus/dbus/bus/session.conf.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- session.conf.in	26 Jan 2007 16:10:09 -0000	1.12
+++ session.conf.in	15 Mar 2007 13:27:01 -0000	1.13
@@ -14,7 +14,7 @@
 
   <policy context="default">
     <!-- Allow everything to be sent -->
-    <allow send_destination="*"/>
+    <allow send_destination="*" eavesdrop="true"/>
     <!-- Allow everything to be received -->
     <allow eavesdrop="true"/>
     <!-- Allow anyone to own anything -->



More information about the dbus-commit mailing list