Dispatch post-activation messages to anyone interested
authorWill Thompson <will.thompson@collabora.co.uk>
Thu, 4 Feb 2010 20:24:54 +0000 (20:24 +0000)
committerWill Thompson <will.thompson@collabora.co.uk>
Fri, 19 Mar 2010 17:48:00 +0000 (17:48 +0000)
Previously, if a method call activated a service, it would only be
delivered to that service, and not to other services with match rules
which should match. This patch replaces the improperly-duplicated
dispatch code in activation.c with a call back into the normal dispatch
code, fixing this bug (fd.o#26427).

(Additionally, were one to service-activate a service that doesn't
understand file descriptors with a message containing a file descriptor,
the previous code would send it anyway, and the service's dbus library
would blow up. This is also fixed here, since the normal dispatch code
checks this correctly.)

bus/activation.c

index 0a28df1..2fcd85d 100644 (file)
@@ -25,6 +25,7 @@
 #include "activation.h"
 #include "activation-exit-codes.h"
 #include "desktop-file.h"
+#include "dispatch.h"
 #include "services.h"
 #include "test.h"
 #include "utils.h"
@@ -1132,21 +1133,12 @@ bus_activation_send_pending_auto_activation_messages (BusActivation  *activation
           
           addressed_recipient = bus_service_get_primary_owners_connection (service);
 
-          /* Check the security policy, which has the side-effect of adding an
-           * expected pending reply.
-           */
-          if (!bus_context_check_security_policy (activation->context, transaction,
-                                                  entry->connection,
-                                                  addressed_recipient,
-                                                  addressed_recipient,
-                                                  entry->activation_message, error))
+          /* Resume dispatching where we left off in bus_dispatch() */
+          if (!bus_dispatch_matches (transaction,
+                                     entry->connection,
+                                     addressed_recipient,
+                                     entry->activation_message, error))
             goto error;
-
-          if (!bus_transaction_send (transaction, addressed_recipient, entry->activation_message))
-            {
-              BUS_SET_OOM (error);
-              goto error;
-            }
         }
 
       link = next;