Commit 8873c90f authored by Havoc Pennington's avatar Havoc Pennington

2005-01-18 Havoc Pennington <hp@redhat.com>

        * Throughout, grand renaming to strip out the use of "service",
	just say "name" instead (or "bus name" when ambiguous).  Did not
	change the internal code of the message bus itself, only the
	programmer-facing API and messages.

	* doc/dbus-specification.xml: further update the message bus section

	* bus/config-parser.c (all_are_equiv): fix bug using freed string
	in error case
parent 4fce2850
2005-01-18 Havoc Pennington <hp@redhat.com>
* Throughout, grand renaming to strip out the use of "service",
just say "name" instead (or "bus name" when ambiguous). Did not
change the internal code of the message bus itself, only the
programmer-facing API and messages.
* doc/dbus-specification.xml: further update the message bus section
* bus/config-parser.c (all_are_equiv): fix bug using freed string
in error case
2005-01-17 Havoc Pennington <hp@redhat.com>
* dbus/dbus-types.h: remove 16-bit types since we don't use them
......
......@@ -789,13 +789,13 @@ child_setup (void *data)
/* If no memory, we simply have the child exit, so it won't try
* to connect to the wrong thing.
*/
if (!_dbus_setenv ("DBUS_ACTIVATION_ADDRESS", activation->server_address))
if (!_dbus_setenv ("DBUS_STARTER_ADDRESS", activation->server_address))
_dbus_exit (1);
type = bus_context_get_type (activation->context);
if (type != NULL)
{
if (!_dbus_setenv ("DBUS_BUS_TYPE", type))
if (!_dbus_setenv ("DBUS_STARTER_BUS_TYPE", type))
_dbus_exit (1);
if (strcmp (type, "session") == 0)
......@@ -920,7 +920,7 @@ bus_activation_service_created (BusActivation *activation,
goto error;
}
result = DBUS_ACTIVATION_REPLY_ACTIVATED;
result = DBUS_START_REPLY_SUCCESS;
if (!dbus_message_append_args (message,
DBUS_TYPE_UINT32, &result,
......@@ -1280,8 +1280,8 @@ activation_find_entry (BusActivation *activation,
if (!entry)
{
dbus_set_error (error, DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND,
"The service %s was not found in the activation entry list",
dbus_set_error (error, DBUS_ERROR_SERVICE_UNKNOWN,
"The name %s was not provided by any .service files",
service_name);
return NULL;
}
......@@ -1347,7 +1347,7 @@ bus_activation_activate_service (BusActivation *activation,
return FALSE;
}
result = DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE;
result = DBUS_START_REPLY_ALREADY_RUNNING;
if (!dbus_message_append_args (message,
DBUS_TYPE_UINT32, &result,
......
......@@ -1677,7 +1677,7 @@ set_limit (BusConfigParser *parser,
must_be_positive = TRUE;
parser->limits.max_message_size = value;
}
else if (strcmp (name, "activation_timeout") == 0)
else if (strcmp (name, "service_start_timeout") == 0)
{
must_be_positive = TRUE;
must_be_int = TRUE;
......@@ -1713,13 +1713,13 @@ set_limit (BusConfigParser *parser,
must_be_int = TRUE;
parser->limits.max_connections_per_user = value;
}
else if (strcmp (name, "max_pending_activations") == 0)
else if (strcmp (name, "max_pending_service_starts") == 0)
{
must_be_positive = TRUE;
must_be_int = TRUE;
parser->limits.max_pending_activations = value;
}
else if (strcmp (name, "max_services_per_connection") == 0)
else if (strcmp (name, "max_names_per_connection") == 0)
{
must_be_positive = TRUE;
must_be_int = TRUE;
......@@ -2814,28 +2814,29 @@ all_are_equiv (const DBusString *target_directory)
printf (" %s\n", _dbus_string_get_const_data (&filename));
parser = bus_config_load (&full_path, TRUE, NULL, &error);
_dbus_string_free (&full_path);
if (parser == NULL)
{
_dbus_warn ("Could not load file %s: %s\n",
_dbus_string_get_const_data (&full_path),
error.message);
_dbus_string_free (&full_path);
dbus_error_free (&error);
goto finished;
}
else if (first_parser == NULL)
{
_dbus_string_free (&full_path);
first_parser = parser;
}
else
{
_dbus_string_free (&full_path);
equal = config_parsers_equal (first_parser, parser);
bus_config_parser_unref (parser);
if (! equal)
goto finished;
}
}
retval = TRUE;
......
......@@ -23,7 +23,7 @@ exchange messages with one another.
.PP
There are two standard message bus instances: the systemwide message bus
(installed on many systems as the "messagebus" service) and the
(installed on many systems as the "messagebus" init service) and the
per-user-login-session message bus (started each time a user logs in).
\fIdbus-daemon-1\fP is used for both of these instances, but with
a different configuration file.
......@@ -212,7 +212,7 @@ Example: <listen>unix:path=/tmp/foo</listen>
.PP
If there are multiple <listen> elements, then the bus listens
on multiple addresses. The bus will pass its address to
activated services or other interested parties with
started services or other interested parties with
the last address given in <listen> first. That is,
apps will try to connect to the last <listen> address first.
......@@ -241,8 +241,8 @@ scanned starting with the last to appear in the config file
service will be used).
.PP
Service files tell the bus how to automatically start a particular
service. They are primarily used with the per-user-session bus,
Service files tell the bus how to automatically start a program.
They are primarily used with the per-user-session bus,
not the systemwide bus.
.TP
......@@ -265,8 +265,8 @@ Available limit names are:
queued up for a single connection
"max_message_size" : max size of a single message in
bytes
"activation_timeout" : milliseconds (thousandths) until
an activated service has to connect
"service_start_timeout" : milliseconds (thousandths) until
a started service has to connect
"auth_timeout" : milliseconds (thousandths) a
connection is given to
authenticate
......@@ -275,9 +275,9 @@ Available limit names are:
connections
"max_connections_per_user" : max number of completed connections from
the same user
"max_pending_activations" : max number of activations in
"max_pending_service_starts" : max number of service launches in
progress at the same time
"max_services_per_connection": max number of services a single
"max_names_per_connection" : max number of names a single
connection can own
"max_match_rules_per_connection": max number of match rules for a single
connection
......@@ -347,14 +347,14 @@ The possible attributes of these elements are:
send_interface="interface_name"
send_member="method_or_signal_name"
send_error="error_name"
send_destination="service_name"
send_destination="name"
send_type="method_call" | "method_return" | "signal" | "error"
send_path="/path/name"
receive_interface="interface_name"
receive_member="method_or_signal_name"
receive_error="error_name"
receive_sender="service_name"
receive_sender="name"
receive_type="method_call" | "method_return" | "signal" | "error"
receive_path="/path/name"
......@@ -363,7 +363,7 @@ The possible attributes of these elements are:
eavesdrop="true" | "false"
own="servicename"
own="name"
user="username"
group="groupname"
.fi
......@@ -387,8 +387,8 @@ rules in the config file allow it).
.PP
send_destination and receive_sender rules mean that messages may not be
sent to or received from the *owner* of the given service, not that
they may not be sent *to that service name*. That is, if a connection
sent to or received from the *owner* of the given name, not that
they may not be sent *to that name*. That is, if a connection
owns services A, B, C, and sending to A is denied, sending to B or C
will not work either.
......@@ -398,7 +398,7 @@ matches against the given field in the message header.
.PP
"Eavesdropping" occurs when an application receives a message that
was explicitly addressed to a service the application does not own.
was explicitly addressed to a name the application does not own.
Eavesdropping thus only applies to messages that are addressed to
services (i.e. it does not apply to signals).
......@@ -437,7 +437,7 @@ user and group denials mean that the given user or group may
not connect to the message bus.
.PP
For "service_name", "username", "groupname", etc.
For "name", "username", "groupname", etc.
the character "*" can be substituted, meaning "any." Complex globs
like "foo.bar.*" aren't allowed for now because they'd be work to
implement and maybe encourage sloppy security anyway.
......@@ -449,10 +449,10 @@ context="default" or context="mandatory" policies.
.PP
A single <deny> rule may specify combinations of attributes such as
send_service and send_interface and send_type. In this case, the
send_destination and send_interface and send_type. In this case, the
denial applies only if both attributes match the message being denied.
e.g. <deny send_interface="foo.bar" send_service="foo.blah"/> would
deny messages of the given interface AND to the given service.
e.g. <deny send_interface="foo.bar" send_destination="foo.blah"/> would
deny messages with the given interface AND the given bus name.
To get an OR effect you specify multiple <deny> rules.
.PP
......@@ -482,17 +482,17 @@ creates a mapping. Right now only one kind of association is possible:
.fi
.PP
This means that if a connection asks to own the service
This means that if a connection asks to own the name
"org.freedesktop.Foobar" then the source context will be the context
of the connection and the target context will be "foo_t" - see the
short discussion of SELinux below.
.PP
Note, the context here is the target context when acquiring a service,
NOT the context of the connection owning the service.
Note, the context here is the target context when requesting a name,
NOT the context of the connection owning the name.
.PP
There's currently no way to set a default for owning any service, if
There's currently no way to set a default for owning any name, if
we add this syntax it will look like:
.nf
<associate own="*" context="foo_t"/>
......@@ -501,9 +501,8 @@ If you find a reason this is useful, let the developers know.
Right now the default will be the security context of the bus itself.
.PP
If two <associate> elements specify the same service name,
the element appearing later in the configuration file will
be used.
If two <associate> elements specify the same name, the element
appearing later in the configuration file will be used.
.SH SELinux
......@@ -557,14 +556,14 @@ connect to the systemwide bus. If this changes, we'll
probably add a way to set the default connection context.
.PP
Second, any time a connection asks to own a service,
Second, any time a connection asks to own a name,
the bus daemon will check permissions with the security
context of the connection as source, the security context specified
for the service name with an <associate> element as target, object
for the name with an <associate> element as target, object
class "dbus" and requested permission "acquire_svc".
.PP
If the service name has no security context associated in the
If the name has no security context associated in the
configuration file, the security context of the bus daemon
itself will be used.
......
This diff is collapsed.
......@@ -52,14 +52,14 @@ bus_driver_send_service_owner_changed (const char *service_name,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
null_service = "";
_dbus_verbose ("sending service owner changed: %s [%s -> %s]\n",
_dbus_verbose ("sending name owner changed: %s [%s -> %s]\n",
service_name,
old_owner ? old_owner : null_service,
new_owner ? new_owner : null_service);
message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_DBUS,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceOwnerChanged");
"NameOwnerChanged");
if (message == NULL)
{
......@@ -102,7 +102,7 @@ bus_driver_send_service_lost (DBusConnection *connection,
message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_DBUS,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceLost");
"NameLost");
if (message == NULL)
{
......@@ -145,7 +145,7 @@ bus_driver_send_service_acquired (DBusConnection *connection,
message = dbus_message_new_signal (DBUS_PATH_ORG_FREEDESKTOP_DBUS,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceAcquired");
"NameAcquired");
if (message == NULL)
{
......@@ -597,7 +597,7 @@ bus_driver_handle_activate_service (DBusConnection *connection,
DBUS_TYPE_INVALID))
{
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_verbose ("No memory to get arguments to ActivateService\n");
_dbus_verbose ("No memory to get arguments to StartServiceByName\n");
return FALSE;
}
......@@ -795,17 +795,18 @@ bus_driver_handle_get_service_owner (DBusConnection *connection,
if (service == NULL)
{
dbus_set_error (error,
DBUS_ERROR_SERVICE_HAS_NO_OWNER,
"Could not get owner of service '%s': no such service", text);
DBUS_ERROR_NAME_HAS_NO_OWNER,
"Could not get owner of name '%s': no such name", text);
goto failed;
}
base_name = bus_connection_get_name (bus_service_get_primary_owner (service));
if (base_name == NULL)
{
/* FIXME - how is this error possible? */
dbus_set_error (error,
DBUS_ERROR_FAILED,
"Could not determine base service for '%s'", text);
"Could not determine unique name for '%s'", text);
goto failed;
}
_dbus_assert (*base_name == ':');
......@@ -870,8 +871,8 @@ bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
if (serv == NULL)
{
dbus_set_error (error,
DBUS_ERROR_SERVICE_HAS_NO_OWNER,
"Could not get owner of service '%s': no such service", service);
DBUS_ERROR_NAME_HAS_NO_OWNER,
"Could not get UID of name '%s': no such name", service);
goto failed;
}
......@@ -946,8 +947,8 @@ bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
if (serv == NULL)
{
dbus_set_error (error,
DBUS_ERROR_SERVICE_HAS_NO_OWNER,
"Could not get owner of service '%s': no such service", service);
DBUS_ERROR_NAME_HAS_NO_OWNER,
"Could not get PID of name '%s': no such name", service);
goto failed;
}
......@@ -1026,14 +1027,14 @@ struct
DBusMessage *message,
DBusError *error);
} message_handlers[] = {
{ "AcquireService", bus_driver_handle_acquire_service },
{ "ActivateService", bus_driver_handle_activate_service },
{ "RequestName", bus_driver_handle_acquire_service },
{ "StartServiceByName", bus_driver_handle_activate_service },
{ "Hello", bus_driver_handle_hello },
{ "ServiceExists", bus_driver_handle_service_exists },
{ "ListServices", bus_driver_handle_list_services },
{ "NameHasOwner", bus_driver_handle_service_exists },
{ "ListNames", bus_driver_handle_list_services },
{ "AddMatch", bus_driver_handle_add_match },
{ "RemoveMatch", bus_driver_handle_remove_match },
{ "GetServiceOwner", bus_driver_handle_get_service_owner },
{ "GetNameOwner", bus_driver_handle_get_service_owner },
{ "GetConnectionUnixUser", bus_driver_handle_get_connection_unix_user },
{ "GetConnectionUnixProcessID", bus_driver_handle_get_connection_unix_process_id },
{ "ReloadConfig", bus_driver_handle_reload_config }
......
......@@ -375,14 +375,14 @@ bus_registry_acquire_service (BusRegistry *registry,
_dbus_assert (current_owner == connection);
bus_service_set_prohibit_replacement (service,
(flags & DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT));
(flags & DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT));
*result = DBUS_SERVICE_REPLY_PRIMARY_OWNER;
*result = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER;
}
else if (old_owner == connection)
*result = DBUS_SERVICE_REPLY_ALREADY_OWNER;
else if (!((flags & DBUS_SERVICE_FLAG_REPLACE_EXISTING)))
*result = DBUS_SERVICE_REPLY_SERVICE_EXISTS;
*result = DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER;
else if (!((flags & DBUS_NAME_FLAG_REPLACE_EXISTING)))
*result = DBUS_REQUEST_NAME_REPLY_EXISTS;
else if (bus_service_get_prohibit_replacement (service))
{
/* Queue the connection */
......@@ -390,14 +390,14 @@ bus_registry_acquire_service (BusRegistry *registry,
transaction, error))
goto out;
*result = DBUS_SERVICE_REPLY_IN_QUEUE;
*result = DBUS_REQUEST_NAME_REPLY_IN_QUEUE;
}
else
{
/* Replace the current owner */
/* We enqueue the new owner and remove the first one because
* that will cause ServiceAcquired and ServiceLost messages to
* that will cause NameAcquired and NameLost messages to
* be sent.
*/
......@@ -410,7 +410,7 @@ bus_registry_acquire_service (BusRegistry *registry,
goto out;
_dbus_assert (connection == bus_service_get_primary_owner (service));
*result = DBUS_SERVICE_REPLY_PRIMARY_OWNER;
*result = DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER;
}
activation = bus_context_get_activation (registry->context);
......
......@@ -657,10 +657,10 @@ bus_match_rule_parse (DBusConnection *matches_go_to,
goto failed;
}
if (!_dbus_validate_service (&tmp_str, 0, len))
if (!_dbus_validate_bus_name (&tmp_str, 0, len))
{
dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID,
"Sender service name '%s' is invalid\n", value);
"Sender name '%s' is invalid\n", value);
goto failed;
}
......@@ -745,10 +745,10 @@ bus_match_rule_parse (DBusConnection *matches_go_to,
goto failed;
}
if (!_dbus_validate_service (&tmp_str, 0, len))
if (!_dbus_validate_bus_name (&tmp_str, 0, len))
{
dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID,
"Destination service name '%s' is invalid\n", value);
"Destination name '%s' is invalid\n", value);
goto failed;
}
......
This diff is collapsed.
......@@ -35,22 +35,22 @@ DBusConnection *dbus_bus_get (DBusBusType type,
DBusError *error);
dbus_bool_t dbus_bus_register (DBusConnection *connection,
DBusError *error);
dbus_bool_t dbus_bus_set_base_service (DBusConnection *connection,
const char *base_service);
const char* dbus_bus_get_base_service (DBusConnection *connection);
dbus_bool_t dbus_bus_set_unique_name (DBusConnection *connection,
const char *unique_name);
const char* dbus_bus_get_unique_name (DBusConnection *connection);
unsigned long dbus_bus_get_unix_user (DBusConnection *connection,
const char *service,
const char *name,
DBusError *error);
int dbus_bus_acquire_service (DBusConnection *connection,
const char *service_name,
int dbus_bus_request_name (DBusConnection *connection,
const char *name,
unsigned int flags,
DBusError *error);
dbus_bool_t dbus_bus_service_exists (DBusConnection *connection,
const char *service_name,
dbus_bool_t dbus_bus_name_has_owner (DBusConnection *connection,
const char *name,
DBusError *error);
dbus_bool_t dbus_bus_activate_service (DBusConnection *connection,
const char *service_name,
dbus_bool_t dbus_bus_start_service_by_name (DBusConnection *connection,
const char *name,
dbus_uint32_t flags,
dbus_uint32_t *reply,
DBusError *error);
......
......@@ -111,14 +111,14 @@ typedef struct DBusGProxyClass DBusGProxyClass;
GType dbus_g_proxy_get_type (void) G_GNUC_CONST;
DBusGProxy* dbus_g_proxy_new_for_service (DBusGConnection *connection,
const char *service_name,
const char *path_name,
const char *interface_name);
DBusGProxy* dbus_g_proxy_new_for_service_owner (DBusGConnection *connection,
const char *service_name,
const char *path_name,
const char *interface_name,
DBusGProxy* dbus_g_proxy_new_for_name (DBusGConnection *connection,
const char *name,
const char *path,
const char *interface);
DBusGProxy* dbus_g_proxy_new_for_name_owner (DBusGConnection *connection,
const char *name,
const char *path,
const char *interface,
GError **error);
DBusGProxy* dbus_g_proxy_new_for_peer (DBusGConnection *connection,
const char *path_name,
......
......@@ -505,7 +505,7 @@ _dbus_header_copy (const DBusHeader *header,
*
* @param header the header
* @param message_type the message type
* @param destination service field or #NULL
* @param destination destination field or #NULL
* @param path path field or #NULL
* @param interface interface field or #NULL
* @param member member field or #NULL
......@@ -833,7 +833,7 @@ load_and_validate_field (DBusHeader *header,
switch (field)
{
case DBUS_HEADER_FIELD_DESTINATION:
string_validation_func = _dbus_validate_service;
string_validation_func = _dbus_validate_bus_name;
bad_string_code = DBUS_INVALID_BAD_DESTINATION;
break;
case DBUS_HEADER_FIELD_INTERFACE:
......@@ -861,7 +861,7 @@ load_and_validate_field (DBusHeader *header,
break;
case DBUS_HEADER_FIELD_SENDER:
string_validation_func = _dbus_validate_service;
string_validation_func = _dbus_validate_bus_name;
bad_string_code = DBUS_INVALID_BAD_SENDER;
break;
......
......@@ -729,13 +729,13 @@ _dbus_validate_error_name (const DBusString *str,
/* This assumes the first char exists and is ':' */
static dbus_bool_t
_dbus_validate_base_service (const DBusString *str,
_dbus_validate_unique_name (const DBusString *str,
int start,
int len)
{
const unsigned char *s;
const unsigned char *end;
const unsigned char *service;
const unsigned char *name;
_dbus_assert (start >= 0);
_dbus_assert (len >= 0);
......@@ -749,10 +749,10 @@ _dbus_validate_base_service (const DBusString *str,
_dbus_assert (len > 0);
service = _dbus_string_get_const_data (str) + start;
end = service + len;
_dbus_assert (*service == ':');
s = service + 1;
name = _dbus_string_get_const_data (str) + start;
end = name + len;
_dbus_assert (*name == ':');
s = name + 1;
while (s != end)
{
......@@ -776,9 +776,9 @@ _dbus_validate_base_service (const DBusString *str,
}
/**
* Checks that the given range of the string is a valid service name
* in the D-BUS protocol. This includes a length restriction, etc.,
* see the specification.
* Checks that the given range of the string is a valid bus name in
* the D-BUS protocol. This includes a length restriction, etc., see
* the specification.
*
* @todo this is inconsistent with most of DBusString in that
* it allows a start,len range that extends past the string end.
......@@ -789,14 +789,14 @@ _dbus_validate_base_service (const DBusString *str,
* @returns #TRUE if the byte range exists and is a valid name
*/
dbus_bool_t
_dbus_validate_service (const DBusString *str,
_dbus_validate_bus_name (const DBusString *str,
int start,
int len)
{
if (_DBUS_UNLIKELY (len == 0))
return FALSE;
if (_dbus_string_get_byte (str, start) == ':')
return _dbus_validate_base_service (str, start, len);
return _dbus_validate_unique_name (str, start, len);
else
return _dbus_validate_interface (str, start, len);
}
......@@ -836,8 +836,8 @@ DEFINE_DBUS_NAME_CHECK(interface);
DEFINE_DBUS_NAME_CHECK(member);
/** define _dbus_check_is_valid_error_name() */
DEFINE_DBUS_NAME_CHECK(error_name);
/** define _dbus_check_is_valid_service() */
DEFINE_DBUS_NAME_CHECK(service);
/** define _dbus_check_is_valid_bus_name() */
DEFINE_DBUS_NAME_CHECK(bus_name);
/** define _dbus_check_is_valid_signature() */
DEFINE_DBUS_NAME_CHECK(signature);
......@@ -974,7 +974,7 @@ _dbus_marshal_validate_test (void)
"foo bar"
};
const char *valid_base_services[] = {
const char *valid_unique_names[] = {
":0",
":a",
":",
......@@ -985,7 +985,7 @@ _dbus_marshal_validate_test (void)
":.blah",
":abce.freedesktop.blah"
};
const char *invalid_base_services[] = {
const char *invalid_unique_names[] = {
":-",
":!",
":0-10",
......@@ -1104,7 +1104,7 @@ _dbus_marshal_validate_test (void)
++i;
}
/* Service validation (check that valid interfaces are valid services,
/* Bus name validation (check that valid interfaces are valid bus names,
* and invalid interfaces are invalid services except if they start with ':')
*/
i = 0;
......@@ -1112,11 +1112,11 @@ _dbus_marshal_validate_test (void)
{
_dbus_string_init_const (&str, valid_interfaces[i]);
if (!_dbus_validate_service (&str, 0,
if (!_dbus_validate_bus_name (&str, 0,
_dbus_string_get_length (&str)))
{
_dbus_warn ("Service \"%s\" should have been valid\n", valid_interfaces[i]);
_dbus_assert_not_reached ("invalid service");
_dbus_warn ("Bus name \"%s\" should have been valid\n", valid_interfaces[i]);
_dbus_assert_not_reached ("invalid bus name");
}
++i;
......@@ -1129,43 +1129,43 @@ _dbus_marshal_validate_test (void)
{
_dbus_string_init_const (&str, invalid_interfaces[i]);
if (_dbus_validate_service (&str, 0,
if (_dbus_validate_bus_name (&str, 0,
_dbus_string_get_length (&str)))
{
_dbus_warn ("Service \"%s\" should have been invalid\n", invalid_interfaces[i]);
_dbus_assert_not_reached ("valid service");
_dbus_warn ("Bus name \"%s\" should have been invalid\n", invalid_interfaces[i]);
_dbus_assert_not_reached ("valid bus name");
}
}
++i;
}
/* Base service validation */
/* unique name validation */
i = 0;
while (i < (int) _DBUS_N_ELEMENTS (valid_base_services))
while (i < (int) _DBUS_N_ELEMENTS (valid_unique_names))
{
_dbus_string_init_const (&str, valid_base_services[i]);
_dbus_string_init_const (&str, valid_unique_names[i]);
if (!_dbus_validate_service (&str, 0,
if (!_dbus_validate_bus_name (&str, 0,
_dbus_string_get_length (&str)))
{
_dbus_warn ("Service \"%s\" should have been valid\n", valid_base_services[i]);
_dbus_assert_not_reached ("invalid base service");
_dbus_warn ("Bus name \"%s\" should have been valid\n", valid_unique_names[i]);
_dbus_assert_not_reached ("invalid unique name");
}
++i;
}
i = 0;
while (i < (int) _DBUS_N_ELEMENTS (invalid_base_services))
while (i < (int) _DBUS_N_ELEMENTS (invalid_unique_names))
{
_dbus_string_init_const (&str, invalid_base_services[i]);
_dbus_string_init_const (&str, invalid_unique_names[i]);
if (_dbus_validate_service (&str, 0,
if (_dbus_validate_bus_name (&str, 0,
_dbus_string_get_length (&str)))
{
_dbus_warn ("Service \"%s\" should have been invalid\n", invalid_base_services[i]);
_dbus_assert_not_reached ("valid base service");
_dbus_warn ("Bus name \"%s\" should have been invalid\n", invalid_unique_names[i]);
_dbus_assert_not_reached ("valid unique name");
}
++i;
......@@ -1271,7 +1271,7 @@ _dbus_marshal_validate_test (void)
/* Validate claimed length longer than real length */
_dbus_string_init_const (&str, "abc.efg");
if (_dbus_validate_service (&str, 0, 8))
if (_dbus_validate_bus_name (&str, 0, 8))
_dbus_assert_not_reached ("validated too-long string");
if (_dbus_validate_interface (&str, 0, 8))
_dbus_assert_not_reached ("validated too-long string");
......@@ -1294,7 +1294,7 @@ _dbus_marshal_validate_test (void)
if (!_dbus_string_append (&str, "abc.def"))
_dbus_assert_not_reached ("no memory");
if (_dbus_validate_service (&str, 0, _dbus_string_get_length (&str)))
if (_dbus_validate_bus_name (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
if (_dbus_validate_interface (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
......@@ -1310,14 +1310,14 @@ _dbus_marshal_validate_test (void)
if (_dbus_validate_member (&str, 0, _dbus_string_get_length (&str)))
_dbus_assert_not_reached ("validated overmax string");
/* overlong base service */
/* overlong unique name */
_dbus_string_set_length (&str, 0);
_dbus_string_append (&str, ":");
while (_dbus_string_get_length (&str) <= DBUS_MAXIMUM_NAME_LENGTH)
if (!_dbus_string_append (&str, "abc"))
_dbus_assert_not_reached ("no memory");