diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | bus/services.c | 27 | ||||
-rw-r--r-- | dbus/dbus-internals.h | 4 | ||||
-rw-r--r-- | dbus/dbus-sysdeps.c | 3 | ||||
-rw-r--r-- | dbus/dbus-threads.c | 2 |
5 files changed, 53 insertions, 2 deletions
@@ -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. diff --git a/bus/services.c b/bus/services.c index bb7e77f4..918f19d9 100644 --- a/bus/services.c +++ b/bus/services.c @@ -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) diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 5d0d2498..9deee993 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -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); diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 20ff014f..0a97a1d8 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -69,6 +69,9 @@ #define socklen_t int #endif +_DBUS_DEFINE_GLOBAL_LOCK (win_fds); +_DBUS_DEFINE_GLOBAL_LOCK (sid_atom_cache); + /** * @addtogroup DBusInternalsUtils * @{ diff --git a/dbus/dbus-threads.c b/dbus/dbus-threads.c index 78269634..7d7646e2 100644 --- a/dbus/dbus-threads.c +++ b/dbus/dbus-threads.c @@ -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), |