]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
Patch provided by Ralf Habacker (ralf dot habacker at freenet dot de)
authorJohn (J5) Palmieri <johnp@redhat.com>
Fri, 18 Aug 2006 15:46:59 +0000 (15:46 +0000)
committerJohn (J5) Palmieri <johnp@redhat.com>
Fri, 18 Aug 2006 15:46:59 +0000 (15:46 +0000)
* dbus/dbus-sysdeps.c, dbus/dbus-threads.c, dbus/dbus-internals.h:
  Add two more global locks for use on windows platforms.  These are
  unused on non-windows platforms but are not ifdefed out to avoid
  potential bugs (i.e. the few bytes lost does not warrent the extra
  maintanence and complexity that having seperate sets of locks would
  cause)

ChangeLog
bus/services.c
dbus/dbus-internals.h
dbus/dbus-sysdeps.c
dbus/dbus-threads.c

index c855d6cefd26b18ceb3c96b94b2db461897a75c9..3bf29465504d634df040aed15e915ee3bb6664c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2006-08-18  John (J5) Palmieri  <johnp@redhat.com>
+
+       Patch provided by Ralf Habacker (ralf dot habacker at freenet dot de) 
+
+       * dbus/dbus-sysdeps.c, dbus/dbus-threads.c, dbus/dbus-internals.h:
+       Add two more global locks for use on windows platforms.  These are
+       unused on non-windows platforms but are not ifdefed out to avoid
+       potential bugs (i.e. the few bytes lost does not warrent the extra
+       maintanence and complexity that having seperate sets of locks would
+       cause)
+
+2006-08-18  John (J5) Palmieri  <johnp@redhat.com>
+
+       * bus/services.c (bus_registry_acquire_service): Return an error
+       when an application tries to register the org.freedesktop.DBus Bus Name
+
+       * bus/services.c (bus_registry_release_service): Return an error
+       when an application tries to release the org.freedesktop.DBus Bus Name
+
 2006-08-17  Alp Toker  <alp@atoker.com>
 
        * doc/dbus-specification.xml: Fix some minor typos.
index bb7e77f4e161bcb406b4ac69e029f2c59911c76c..918f19d96effd59c341323ad13a0854b9c5b932e 100644 (file)
@@ -417,6 +417,18 @@ bus_registry_acquire_service (BusRegistry      *registry,
       goto out;
     }
 
+  if (_dbus_string_equal_c_str (service_name, DBUS_SERVICE_DBUS))
+    {
+      dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
+                      "Connection \"%s\" is not allowed to own the service \"%s\"because "
+                      "it is reserved for D-Bus' use only",
+                      bus_connection_is_active (connection) ?
+                      bus_connection_get_name (connection) :
+                      "(inactive)",
+                      DBUS_SERVICE_DBUS);
+      goto out;
+    }
+
   policy = bus_connection_get_policy (connection);
   _dbus_assert (policy != NULL);
 
@@ -445,7 +457,7 @@ bus_registry_acquire_service (BusRegistry      *registry,
                       _dbus_string_get_const_data (service_name));
       goto out;
     }
-      
+  
   if (!bus_client_policy_check_can_own (policy, connection,
                                         service_name))
     {
@@ -623,6 +635,19 @@ bus_registry_release_service (BusRegistry      *registry,
       goto out;
     }
 
+   if (_dbus_string_equal_c_str (service_name, DBUS_SERVICE_DBUS))
+    {
+      /* Not allowed; the base service name cannot be created or released */
+      dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
+                      "Cannot release the %s service because it is owned by the bus",
+                     DBUS_SERVICE_DBUS);
+
+      _dbus_verbose ("Attempt to release service name \"%s\"",
+                     DBUS_SERVICE_DBUS);
+
+      goto out;
+    }
+
   service = bus_registry_lookup (registry, service_name);
 
   if (service == NULL)
index 5d0d24981ab2f9feaced9033a033b3cd0ee8f3a6..9deee993ee776cbf13efc1ddd387d8139f8721cd 100644 (file)
@@ -281,7 +281,9 @@ _DBUS_DECLARE_GLOBAL_LOCK (shutdown_funcs);
 _DBUS_DECLARE_GLOBAL_LOCK (system_users);
 _DBUS_DECLARE_GLOBAL_LOCK (message_cache);
 _DBUS_DECLARE_GLOBAL_LOCK (shared_connections);
-#define _DBUS_N_GLOBAL_LOCKS (11)
+_DBUS_DECLARE_GLOBAL_LOCK (win_fds);
+_DBUS_DECLARE_GLOBAL_LOCK (sid_atom_cache);
+#define _DBUS_N_GLOBAL_LOCKS (13)
 
 dbus_bool_t _dbus_threads_init_debug (void);
 
index 20ff014f569183b4201887130a13e3fc43c7233f..0a97a1d88468c4432f43448c0f6a852119e0a514 100644 (file)
@@ -69,6 +69,9 @@
 #define socklen_t int
 #endif
 
+_DBUS_DEFINE_GLOBAL_LOCK (win_fds);
+_DBUS_DEFINE_GLOBAL_LOCK (sid_atom_cache);
+
 /**
  * @addtogroup DBusInternalsUtils
  * @{
index 782696346bacd0de9e292128e844b37131761f6c..7d7646e212a88e3af22197d8c5d3d4aad58c3a60 100644 (file)
@@ -405,6 +405,8 @@ init_locks (void)
   
   DBusMutex **global_locks[] = {
 #define LOCK_ADDR(name) (& _dbus_lock_##name)
+    LOCK_ADDR (win_fds),
+    LOCK_ADDR (sid_atom_cache),
     LOCK_ADDR (list),
     LOCK_ADDR (connection_slots),
     LOCK_ADDR (pending_call_slots),