Commit 68a3c593 authored by Havoc Pennington's avatar Havoc Pennington

2003-08-18 Havoc Pennington <hp@redhat.com>

	* dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix

	* dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix
	dumb bug created earlier (wrong order of args to
	decode_header_data())

	* tools/dbus-send.c: port

	* tools/dbus-print-message.c (print_message): port

        * test/data/*messages: port all messages over

        * dbus/dbus-message-builder.c: support including
	message type

        * bus/driver.c: port over

	* bus/dispatch.c: port over to new stuff

	* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
	rename disconnect signal to "Disconnected"
parent 95717a93
2003-08-18 Havoc Pennington <hp@redhat.com>
* dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix
* dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix
dumb bug created earlier (wrong order of args to
decode_header_data())
* tools/dbus-send.c: port
* tools/dbus-print-message.c (print_message): port
* test/data/*messages: port all messages over
* dbus/dbus-message-builder.c: support including
message type
* bus/driver.c: port over
* bus/dispatch.c: port over to new stuff
* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
rename disconnect signal to "Disconnected"
2003-08-17 Havoc Pennington <hp@pobox.com>
This doesn't compile yet, but syncing up so I can hack on it from
......
......@@ -870,8 +870,9 @@ bus_context_check_security_policy (BusContext *context,
* the hello message to the bus driver
*/
if (recipient == NULL &&
dbus_message_has_interface (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS) &&
dbus_message_has_member (message, "Hello"))
dbus_message_is_method_call (message,
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"Hello"))
{
_dbus_verbose ("security check allowing %s message\n",
"Hello");
......
......@@ -1560,7 +1560,7 @@ bus_transaction_send_error_reply (BusTransaction *transaction,
_dbus_assert (error != NULL);
_DBUS_ASSERT_ERROR_IS_SET (error);
_dbus_verbose ("Sending error reply %s \"%s\"\n",
error->name, error->message);
......
This diff is collapsed.
......@@ -49,7 +49,8 @@ bus_driver_send_service_deleted (const char *service_name,
_dbus_verbose ("sending service deleted: %s\n", service_name);
message = dbus_message_new_signal (DBUS_MESSAGE_SERVICE_DELETED);
message = dbus_message_new_signal (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceDeleted");
if (message == NULL)
{
......@@ -57,7 +58,7 @@ bus_driver_send_service_deleted (const char *service_name,
return FALSE;
}
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS) ||
if (!dbus_message_set_sender (message, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) ||
!dbus_message_append_args (message,
DBUS_TYPE_STRING, service_name,
DBUS_TYPE_INVALID))
......@@ -83,7 +84,8 @@ bus_driver_send_service_created (const char *service_name,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
message = dbus_message_new_signal (DBUS_MESSAGE_SERVICE_CREATED);
message = dbus_message_new_signal (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceCreated");
if (message == NULL)
{
......@@ -91,7 +93,7 @@ bus_driver_send_service_created (const char *service_name,
return FALSE;
}
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS))
if (!dbus_message_set_sender (message, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS))
{
dbus_message_unref (message);
BUS_SET_OOM (error);
......@@ -123,7 +125,8 @@ bus_driver_send_service_lost (DBusConnection *connection,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
message = dbus_message_new_signal (DBUS_MESSAGE_SERVICE_LOST);
message = dbus_message_new_signal (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceLost");
if (message == NULL)
{
......@@ -164,7 +167,8 @@ bus_driver_send_service_acquired (DBusConnection *connection,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
message = dbus_message_new_signal (DBUS_MESSAGE_SERVICE_ACQUIRED);
message = dbus_message_new_signal (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"ServiceAcquired");
if (message == NULL)
{
......@@ -604,11 +608,11 @@ struct
DBusMessage *message,
DBusError *error);
} message_handlers[] = {
{ DBUS_MESSAGE_ACQUIRE_SERVICE, bus_driver_handle_acquire_service },
{ DBUS_MESSAGE_ACTIVATE_SERVICE, bus_driver_handle_activate_service },
{ DBUS_MESSAGE_HELLO, bus_driver_handle_hello },
{ DBUS_MESSAGE_SERVICE_EXISTS, bus_driver_handle_service_exists },
{ DBUS_MESSAGE_LIST_SERVICES, bus_driver_handle_list_services }
{ "AcquireService", bus_driver_handle_acquire_service },
{ "ActivateService", bus_driver_handle_activate_service },
{ "Hello", bus_driver_handle_hello },
{ "ServiceExists", bus_driver_handle_service_exists },
{ "ListServices", bus_driver_handle_list_services }
};
dbus_bool_t
......@@ -621,15 +625,32 @@ bus_driver_handle_message (DBusConnection *connection,
int i;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
{
_dbus_verbose ("Driver got a non-method-call message, ignoring\n");
return TRUE; /* we just ignore this */
}
_dbus_assert (dbus_message_get_interface (message) != NULL);
_dbus_assert (dbus_message_get_member (message) != NULL);
name = dbus_message_get_member (message);
sender = dbus_message_get_sender (message);
_dbus_verbose ("Driver got a message: %s\n",
dbus_message_get_name (message));
if (strcmp (dbus_message_get_interface (message),
DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS) != 0)
{
_dbus_verbose ("Driver got message to unknown interface \"%s\"\n",
dbus_message_get_interface (message));
goto unknown;
}
_dbus_verbose ("Driver got a method call: %s\n",
dbus_message_get_member (message));
name = dbus_message_get_name (message);
sender = dbus_message_get_sender (message);
/* security checks should have kept this from getting here */
_dbus_assert (sender != NULL || strcmp (name, DBUS_MESSAGE_HELLO) == 0);
_dbus_assert (sender != NULL || strcmp (name, "Hello") == 0);
if (dbus_message_get_reply_serial (message) == 0)
{
......@@ -660,11 +681,13 @@ bus_driver_handle_message (DBusConnection *connection,
++i;
}
_dbus_verbose ("No driver handler for %s\n", name);
unknown:
_dbus_verbose ("No driver handler for message \"%s\"\n",
name);
dbus_set_error (error, DBUS_ERROR_UNKNOWN_METHOD,
"%s does not understand message %s",
DBUS_SERVICE_DBUS, name);
DBUS_SERVICE_ORG_FREEDESKTOP_DBUS, name);
return FALSE;
}
......
......@@ -801,8 +801,9 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
if (rule->d.send.interface != NULL)
{
if (!dbus_message_has_interface (message,
rule->d.send.interface))
if (dbus_message_get_interface (message) == NULL ||
strcmp (dbus_message_get_interface (message),
rule->d.send.interface) != 0)
{
_dbus_verbose (" (policy) skipping rule for different interface\n");
continue;
......@@ -810,8 +811,9 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
}
else if (rule->d.send.member != NULL)
{
if (!dbus_message_has_member (message,
rule->d.send.member))
if (dbus_message_get_member (message) == NULL ||
strcmp (dbus_message_get_member (message),
rule->d.send.member) != 0)
{
_dbus_verbose (" (policy) skipping rule for different member\n");
continue;
......@@ -819,8 +821,9 @@ bus_client_policy_check_can_send (BusClientPolicy *policy,
}
else if (rule->d.send.error != NULL)
{
if (!dbus_message_has_error_name (message,
rule->d.send.error))
if (dbus_message_get_error_name (message) == NULL ||
strcmp (dbus_message_get_error_name (message),
rule->d.send.error) != 0)
{
_dbus_verbose (" (policy) skipping rule for different error name\n");
continue;
......@@ -914,8 +917,9 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
if (rule->d.receive.interface != NULL)
{
if (!dbus_message_has_interface (message,
rule->d.receive.interface))
if (dbus_message_get_interface (message) == NULL ||
strcmp (dbus_message_get_interface (message),
rule->d.receive.interface) != 0)
{
_dbus_verbose (" (policy) skipping rule for different interface\n");
continue;
......@@ -923,8 +927,9 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
}
else if (rule->d.receive.member != NULL)
{
if (!dbus_message_has_member (message,
rule->d.receive.member))
if (dbus_message_get_member (message) == NULL ||
strcmp (dbus_message_get_member (message),
rule->d.receive.member) != 0)
{
_dbus_verbose (" (policy) skipping rule for different member\n");
continue;
......@@ -932,8 +937,9 @@ bus_client_policy_check_can_receive (BusClientPolicy *policy,
}
else if (rule->d.receive.error != NULL)
{
if (!dbus_message_has_error_name (message,
rule->d.receive.error))
if (dbus_message_get_error_name (message) == NULL ||
strcmp (dbus_message_get_error_name (message),
rule->d.receive.error) != 0)
{
_dbus_verbose (" (policy) skipping rule for different error name\n");
continue;
......
......@@ -107,8 +107,9 @@ client_disconnect_handler (DBusMessageHandler *handler,
DBusMessage *message,
void *user_data)
{
if (!dbus_message_has_name (message,
DBUS_MESSAGE_LOCAL_DISCONNECT))
if (!dbus_message_is_signal (message,
DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
"Disconnected"))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
_dbus_verbose ("Removing client %p in disconnect handler\n",
......
......@@ -826,7 +826,7 @@ _dbus_connection_new_for_transport (DBusTransport *transport)
goto error;
disconnect_message = dbus_message_new_signal (DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
"Disconnect");
"Disconnected");
if (disconnect_message == NULL)
goto error;
......
......@@ -1423,17 +1423,24 @@ _dbus_hash_table_insert_two_strings (DBusHashTable *table,
char *key,
void *value)
{
DBusPreallocatedHash *preallocated;
DBusHashEntry *entry;
_dbus_assert (table->key_type == DBUS_HASH_TWO_STRINGS);
entry = (* table->find_function) (table, key, TRUE, NULL, NULL);
preallocated = _dbus_hash_table_preallocate_entry (table);
if (preallocated == NULL)
return FALSE;
if (entry == NULL)
return FALSE; /* no memory */
_dbus_hash_table_insert_string_preallocated (table, preallocated,
key, value);
if (table->free_key_function && entry->key != key)
(* table->free_key_function) (entry->key);
if (table->free_value_function && entry->value != value)
(* table->free_value_function) (entry->value);
entry->key = key;
entry->value = value;
return TRUE;
}
......@@ -1811,8 +1818,8 @@ _dbus_hash_test (void)
if (value == NULL)
goto out;
if (!_dbus_hash_table_insert_string (table4,
key, value))
if (!_dbus_hash_table_insert_two_strings (table4,
key, value))
goto out;
_dbus_assert (count_entries (table1) == i + 1);
......@@ -1832,9 +1839,9 @@ _dbus_hash_test (void)
_dbus_assert (value != NULL);
_dbus_assert (strcmp (value, keys[i]) == 0);
value = _dbus_hash_table_lookup_ulong (table4, i);
value = _dbus_hash_table_lookup_two_strings (table4, keys[i]);
_dbus_assert (value != NULL);
_dbus_assert (strcmp (value, keys[i]) == 0);
_dbus_assert (strcmp (value, "Value!") == 0);
++i;
}
......
......@@ -265,6 +265,29 @@ append_saved_length (DBusString *dest,
return TRUE;
}
static int
message_type_from_string (const DBusString *str,
int start)
{
const char *s;
s = _dbus_string_get_const_data_len (str, start,
_dbus_string_get_length (str) - start);
if (strncmp (s, "method_call", strlen ("method_call")) == 0)
return DBUS_MESSAGE_TYPE_METHOD_CALL;
else if (strncmp (s, "method_return", strlen ("method_return")) == 0)
return DBUS_MESSAGE_TYPE_METHOD_RETURN;
else if (strncmp (s, "signal", strlen ("signal")) == 0)
return DBUS_MESSAGE_TYPE_SIGNAL;
else if (strncmp (s, "error", strlen ("error")) == 0)
return DBUS_MESSAGE_TYPE_ERROR;
else if (strncmp (s, "invalid", strlen ("invalid")) == 0)
return DBUS_MESSAGE_TYPE_INVALID;
else
return -1;
}
/**
* Reads the given filename, which should be in "message description
* language" (look at some examples), and builds up the message data
......@@ -274,7 +297,7 @@ append_saved_length (DBusString *dest,
*
* The file format is:
* @code
* VALID_HEADER normal header; byte order, padding, header len, body len, serial
* VALID_HEADER <type> normal header; byte order, type, padding, header len, body len, serial
* BIG_ENDIAN switch to big endian
* LITTLE_ENDIAN switch to little endian
* OPPOSITE_ENDIAN switch to opposite endian
......@@ -386,6 +409,13 @@ _dbus_message_data_load (DBusString *dest,
{
int i;
DBusString name;
int message_type;
if (_dbus_string_get_length (&line) < strlen ("VALID_HEADER "))
{
_dbus_warn ("no args to VALID_HEADER\n");
goto parse_failed;
}
if (!_dbus_string_append_byte (dest, endian))
{
......@@ -393,7 +423,15 @@ _dbus_message_data_load (DBusString *dest,
goto parse_failed;
}
if (!_dbus_string_append_byte (dest, DBUS_MESSAGE_TYPE_METHOD_CALL))
message_type = message_type_from_string (&line,
strlen ("VALID_HEADER "));
if (message_type < 0)
{
_dbus_warn ("VALID_HEADER not followed by space then known message type\n");
goto parse_failed;
}
if (!_dbus_string_append_byte (dest, message_type))
{
_dbus_warn ("could not append message type\n");
goto parse_failed;
......
......@@ -4049,55 +4049,115 @@ dbus_message_get_sender (DBusMessage *message)
return get_string_field (message, FIELD_SENDER, NULL);
}
static dbus_bool_t
_dbus_message_has_type_interface_member (DBusMessage *message,
int type,
const char *interface,
const char *method)
{
const char *n;
_dbus_assert (message != NULL);
_dbus_assert (interface != NULL);
_dbus_assert (method != NULL);
if (dbus_message_get_type (message) != type)
return FALSE;
/* Optimize by checking the short method name first
* instead of the longer interface name
*/
n = dbus_message_get_member (message);
if (n && strcmp (n, method) == 0)
{
n = dbus_message_get_interface (message);
if (n && strcmp (n, interface) == 0)
return TRUE;
}
return FALSE;
}
/**
* Checks whether the message has the given interface field. If the
* message has no interface field or has a different one, returns
* #FALSE.
* Checks whether the message is a method call with the given
* interface and member fields. If the message is not
* #DBUS_MESSAGE_TYPE_METHOD_CALL, or has a different interface or member field,
* returns #FALSE.
*
* @param message the message
* @param interface the name to check (must not be #NULL)
* @param method the name to check (must not be #NULL)
*
* @returns #TRUE if the message has the given name
* @returns #TRUE if the message is the specified method call
*/
dbus_bool_t
dbus_message_has_interface (DBusMessage *message,
const char *interface)
dbus_message_is_method_call (DBusMessage *message,
const char *interface,
const char *method)
{
const char *n;
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (interface != NULL, FALSE);
n = dbus_message_get_interface (message);
_dbus_return_val_if_fail (method != NULL, FALSE);
if (n && strcmp (n, interface) == 0)
return TRUE;
else
return FALSE;
return _dbus_message_has_type_interface_member (message,
DBUS_MESSAGE_TYPE_METHOD_CALL,
interface, method);
}
/**
* Checks whether the message is a signal with the given
* interface and member fields. If the message is not
* #DBUS_MESSAGE_TYPE_SIGNAL, or has a different interface or member field,
* returns #FALSE.
*
* @param message the message
* @param interface the name to check (must not be #NULL)
* @param signal_name the name to check (must not be #NULL)
*
* @returns #TRUE if the message is the specified signal
*/
dbus_bool_t
dbus_message_is_signal (DBusMessage *message,
const char *interface,
const char *signal_name)
{
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (interface != NULL, FALSE);
_dbus_return_val_if_fail (signal_name != NULL, FALSE);
return _dbus_message_has_type_interface_member (message,
DBUS_MESSAGE_TYPE_SIGNAL,
interface, signal_name);
}
/**
* Checks whether the message has the given member field. If the
* message has no member field or has a different one, returns #FALSE.
* Checks whether the message is an error reply with the given error
* name. If the message is not #DBUS_MESSAGE_TYPE_ERROR, or has a
* different name, returns #FALSE.
*
* @param message the message
* @param member the name to check (must not be #NULL)
* @param error_name the name to check (must not be #NULL)
*
* @returns #TRUE if the message has the given name
* @returns #TRUE if the message is the specified error
*/
dbus_bool_t
dbus_message_has_member (DBusMessage *message,
const char *member)
dbus_message_is_error (DBusMessage *message,
const char *error_name)
{
const char *n;
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (member != NULL, FALSE);
_dbus_return_val_if_fail (message != NULL, FALSE);
_dbus_return_val_if_fail (error_name != NULL, FALSE);
if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
return FALSE;
n = dbus_message_get_member (message);
if (n && strcmp (n, member) == 0)
if (n && strcmp (n, error_name) == 0)
return TRUE;
else
return FALSE;
......@@ -4507,7 +4567,10 @@ decode_header_data (const DBusString *data,
int type;
if (header_len < 16)
return FALSE;
{
_dbus_verbose ("Header length %d is too short\n", header_len);
return FALSE;
}
i = 0;
while (i < FIELD_LAST)
......@@ -4532,7 +4595,10 @@ decode_header_data (const DBusString *data,
pos = _DBUS_ALIGN_VALUE (pos, 4);
if ((pos + 4) > header_len)
return FALSE;
{
_dbus_verbose ("not enough space remains in header for header field value\n");
return FALSE;
}
field =_dbus_string_get_const_data_len (data, pos, 4);
pos += 4;
......@@ -4809,8 +4875,9 @@ _dbus_message_loader_queue_messages (DBusMessageLoader *loader)
#if 0
_dbus_verbose_bytes_of_string (&loader->data, 0, header_len + body_len);
#endif
if (!decode_header_data (&loader->data, message_type,
if (!decode_header_data (&loader->data,
header_len, byte_order,
message_type,
fields, &header_padding))
{
_dbus_verbose ("Header was invalid\n");
......@@ -5919,10 +5986,11 @@ process_test_subdir (const DBusString *test_base_dir,
printf (" %s\n",
_dbus_string_get_const_data (&filename));
_dbus_verbose (" expecting %s\n",
_dbus_verbose (" expecting %s for %s\n",
validity == _DBUS_MESSAGE_VALID ? "valid" :
(validity == _DBUS_MESSAGE_INVALID ? "invalid" :
(validity == _DBUS_MESSAGE_INCOMPLETE ? "incomplete" : "unknown")));
(validity == _DBUS_MESSAGE_INCOMPLETE ? "incomplete" : "unknown")),
_dbus_string_get_const_data (&filename));
if (! (*function) (&full_path, is_raw, validity, user_data))
{
......@@ -6245,8 +6313,8 @@ _dbus_message_test (const char *test_data_dir)
"TestMethod",
"org.freedesktop.DBus.TestService");
_dbus_assert (dbus_message_has_destination (message, "org.freedesktop.DBus.TestService"));
_dbus_assert (dbus_message_has_interface (message, "Foo.TestInterface"));
_dbus_assert (dbus_message_has_member (message, "TestMethod"));
_dbus_assert (dbus_message_is_method_call (message, "Foo.TestInterface",
"TestMethod"));
_dbus_message_set_serial (message, 1234);
dbus_message_set_sender (message, "org.foo.bar");
_dbus_assert (dbus_message_has_sender (message, "org.foo.bar"));
......
......@@ -91,12 +91,14 @@ const char* dbus_message_get_sender (DBusMessage *message);
void dbus_message_set_no_reply (DBusMessage *message,
dbus_bool_t no_reply);
dbus_bool_t dbus_message_get_no_reply (DBusMessage *message);
dbus_bool_t dbus_message_has_interface (DBusMessage *message,
const char *interface);
dbus_bool_t dbus_message_has_member (DBusMessage *message,
const char *member);
dbus_bool_t dbus_message_has_error_name (DBusMessage *message,
const char *name);
dbus_bool_t dbus_message_is_method_call (DBusMessage *message,
const char *interface,
const char *method);
dbus_bool_t dbus_message_is_signal (DBusMessage *message,
const char *interface,
const char *signal_name);
dbus_bool_t dbus_message_is_error (DBusMessage *message,
const char *error_name);
dbus_bool_t dbus_message_has_destination (DBusMessage *message,
const char *service);
dbus_bool_t dbus_message_has_sender (DBusMessage *message,
......
......@@ -106,20 +106,6 @@ extern "C" {
* allowed to specify this interface).
*/
#define DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL "org.freedesktop.Local"
#if 0
/* these are a bad idea, FIXME */
#define DBUS_METHOD_ORG_FREEDESKTOP_DBUS_ACTIVATE_SERVICE "ActivateService"
#define DBUS_METHOD_ORG_FREEDESKTOP_DBUS_SERVICE_EXISTS "ServiceExists"
#define DBUS_METHOD_ORG_FREEDESKTOP_DBUS_HELLO "Hello"
#define DBUS_METHOD_ORG_FREEDESKTOP_DBUS_LIST_SERVICES "ListServices"
#define DBUS_METHOD_ORG_FREEDESKTOP_DBUS_ACQUIRE_SERVICE "AcquireService"
#define DBUS_SIGNAL_ORG_FREEDESKTOP_DBUS_SERVICE_ACQUIRED "ServiceAcquired"
#define DBUS_SIGNAL_ORG_FREEDESKTOP_DBUS_SERVICE_CREATED "ServiceCreated"
#define DBUS_SIGNAL_ORG_FREEDESKTOP_DBUS_SERVICE_DELETED "ServiceDeleted"
#define DBUS_SIGNAL_ORG_FREEDESKTOP_DBUS_SERVICE_LOST "ServiceLost"
#endif /* #if 0 */
#ifdef __cplusplus
}
......
......@@ -2853,6 +2853,9 @@ _dbus_string_validate_nul (const DBusString *str,
*
* @todo this is inconsistent with most of DBusString in that
* it allows a start,len range that isn't in the string.
*
* @todo change spec to disallow more things, such as spaces in the
* interface name
*
* @param str the string
* @param start first byte index to check
......@@ -2911,6 +2914,9 @@ _dbus_string_validate_interface (const DBusString *str,
* @todo this is inconsistent with most of DBusString in that
* it allows a start,len range that isn't in the string.
*
* @todo change spec to disallow more things, such as spaces in the
* member name
*
* @param str the string
* @param start first byte index to check
* @param len number of bytes to check
......@@ -2991,6 +2997,9 @@ _dbus_string_validate_error_name (const DBusString *str,
*
* @todo this is inconsistent with most of DBusString in that
* it allows a start,len range that isn't in the string.
*
* @todo change spec to disallow more things, such as spaces in the
* service name
*
* @param str the string
* @param start first byte index to check
......
......@@ -23,9 +23,6 @@
(changing get_string to have an error return, and allowing a type error
as a possible return)
- We might consider returning a "no such operation" error in dbus-connection.c
for unhandled messages.
- The convenience functions in dbus-bus.h should perhaps have
the signatures that they would have if they were autogenerated
stubs. e.g. the acquire service function. We should also evaluate
......
......@@ -30,8 +30,9 @@ main (int argc, char **argv)
dbus_connection_setup_with_g_main (connection, NULL);
message = dbus_message_new_method_call (DBUS_MESSAGE_HELLO,
DBUS_SERVICE_DBUS);
message = dbus_message_new_method_call (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
"Hello",
DBUS_SERVICE_ORG_FREEDESKTOP_DBUS);
dbus_error_init (&error);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
......@@ -42,7 +43,7 @@ main (int argc, char **argv)
return 1;
}
g_print ("reply name: %s\n", dbus_message_get_name (reply));
g_print ("reply received\n");
g_main_loop_run (loop);
......
......@@ -21,6 +21,11 @@
*
*/
/* FIXME this test is wacky since both client and server keep
* sending each other method calls, but nobody sends
* a DBUS_MESSAGE_TYPE_METHOD_RETURN
*/
#include <config.h>
#include <glib.h>
#include "dbus-glib.h"
......@@ -29,7 +34,9 @@
#define N_CLIENT_THREADS 1
#define N_ITERATIONS 1000
#define PAYLOAD_SIZE 30
#define ECHO_MESSAGE "org.freedesktop.DBus.Test.EchoProfile"