summaryrefslogtreecommitdiffstats
path: root/bus/services.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2005-01-21 03:44:10 +0000
committerHavoc Pennington <hp@redhat.com>2005-01-21 03:44:10 +0000
commitf5cf675641e63cefc36c8a9a7a5872cc8600abcd (patch)
treef8762e202abb21da860b9af677ead55d5150dfa9 /bus/services.c
parent2abdb13ebe737e39653b79fecd93477e156b9db1 (diff)
2005-01-20 Havoc Pennington <hp@redhat.com>
* doc/dbus-tutorial.xml: replace > with &gt; * bus/services.c (bus_registry_acquire_service): validate the name and return a better error if it's no good. * doc/dbus-specification.xml: note NO_AUTO_START change * dbus/dbus-protocol.h (DBUS_HEADER_FLAG_NO_AUTO_START): change from AUTO_START, we're toggling the default * bus/dispatch.c: adapt the tests to change of auto-start default
Diffstat (limited to 'bus/services.c')
-rw-r--r--bus/services.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/bus/services.c b/bus/services.c
index 90c8d1d8..4392daa2 100644
--- a/bus/services.c
+++ b/bus/services.c
@@ -24,6 +24,7 @@
#include <dbus/dbus-hash.h>
#include <dbus/dbus-list.h>
#include <dbus/dbus-mempool.h>
+#include <dbus/dbus-marshal-validate.h>
#include "driver.h"
#include "services.h"
@@ -283,12 +284,14 @@ bus_registry_acquire_service (BusRegistry *registry,
retval = FALSE;
- if (_dbus_string_get_length (service_name) == 0)
+ if (!_dbus_validate_bus_name (service_name, 0,
+ _dbus_string_get_length (service_name)))
{
- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
- "Zero-length service name is not allowed");
+ dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
+ "Requested bus name \"%s\" is not valid",
+ _dbus_string_get_const_data (service_name));
- _dbus_verbose ("Attempt to acquire zero-length service name\n");
+ _dbus_verbose ("Attempt to acquire invalid service name\n");
goto out;
}
@@ -296,7 +299,7 @@ bus_registry_acquire_service (BusRegistry *registry,
if (_dbus_string_get_byte (service_name, 0) == ':')
{
/* Not allowed; only base services can start with ':' */
- dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
"Cannot acquire a service starting with ':' such as \"%s\"",
_dbus_string_get_const_data (service_name));