File CVE-2014-3477.patch of Package dbus-1.2871

--- dbus-1.6.8/bus/activation.c	2012-09-28 21:17:25.000000000 +0200
+++ dbus-1.6.8/bus/activation.c	2014-06-11 17:59:43.517819244 +0200
@@ -1154,14 +1154,11 @@
 dbus_bool_t
 bus_activation_send_pending_auto_activation_messages (BusActivation  *activation,
                                                       BusService     *service,
-                                                      BusTransaction *transaction,
-                                                      DBusError      *error)
+                                                      BusTransaction *transaction)
 {
   BusPendingActivation *pending_activation;
   DBusList *link;
 
-  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
   /* Check if it's a pending activation */
   pending_activation = _dbus_hash_table_lookup_string (activation->pending_activations,
                                                        bus_service_get_name (service));
@@ -1178,6 +1175,9 @@
       if (entry->auto_activation && dbus_connection_get_is_connected (entry->connection))
         {
           DBusConnection *addressed_recipient;
+          DBusError error;
+
+          dbus_error_init (&error);
 
           addressed_recipient = bus_service_get_primary_owners_connection (service);
 
@@ -1185,8 +1185,22 @@
           if (!bus_dispatch_matches (transaction,
                                      entry->connection,
                                      addressed_recipient,
-                                     entry->activation_message, error))
-            goto error;
+                                     entry->activation_message, &error))
+            {
+              /* If permission is denied, we just want to return the error
+               * to the original method invoker; in particular, we don't
+               * want to make the RequestName call fail with that error
+               * (see fd.o #78979, CVE-2014-3477). */
+              if (!bus_transaction_send_error_reply (transaction, entry->connection,
+                                                     &error, entry->activation_message))
+                {
+                  bus_connection_send_oom_error (entry->connection,
+                                                 entry->activation_message);
+                }
+
+              link = next;
+              continue;
+            }
         }
 
       link = next;
@@ -1195,7 +1209,6 @@
   if (!add_restore_pending_to_transaction (transaction, pending_activation))
     {
       _dbus_verbose ("Could not add cancel hook to transaction to revert removing pending activation\n");
-      BUS_SET_OOM (error);
       goto error;
     }
 
--- dbus-1.6.8/bus/activation.h	2011-07-13 22:42:21.000000000 +0200
+++ dbus-1.6.8/bus/activation.h	2014-06-11 17:59:43.517819244 +0200
@@ -62,8 +62,7 @@
 
 dbus_bool_t    bus_activation_send_pending_auto_activation_messages (BusActivation     *activation,
 								     BusService        *service,
-								     BusTransaction    *transaction,
-								     DBusError         *error);
+								     BusTransaction    *transaction);
 
 
 #endif /* BUS_ACTIVATION_H */
--- dbus-1.6.8/bus/services.c	2012-09-28 21:17:25.000000000 +0200
+++ dbus-1.6.8/bus/services.c	2014-06-11 17:59:43.517819244 +0200
@@ -588,8 +588,9 @@
   activation = bus_context_get_activation (registry->context);
   retval = bus_activation_send_pending_auto_activation_messages (activation,
 								 service,
-								 transaction,
-								 error);
+								 transaction);
+  if (!retval)
+    BUS_SET_OOM (error);
   
  out:
   return retval;
openSUSE Build Service is sponsored by