dbus/bus driver.c,1.54,1.55 dispatch.c,1.61,1.62
Olivier Andrieu
oandrieu at freedesktop.org
Fri Sep 17 09:14:51 UTC 2004
Update of /cvs/dbus/dbus/bus
In directory gabe:/tmp/cvs-serv13239/bus
Modified Files:
driver.c dispatch.c
Log Message:
* dbus/dbus-sysdeps.c (_dbus_user_at_console): fix memleak in OOM.
* doc/busconfig.dtd: update the DTD for the at_console attribute.
* bus/driver.c (bus_driver_handle_hello): correctly handle Hello
messages after the first one (bug #1389).
* bus/dispatch.c (check_double_hello_message): add a test case for the
double hello message bug. (check_existent_service_activation): fix
check of spawning error.
Index: driver.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/driver.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- driver.c 26 Aug 2004 17:26:06 -0000 1.54
+++ driver.c 17 Sep 2004 09:14:49 -0000 1.55
@@ -278,6 +278,14 @@
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ if (bus_connection_is_active (connection))
+ {
+ /* We already handled an Hello message for this connection. */
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Already handled an Hello message");
+ return FALSE;
+ }
+
/* Note that when these limits are exceeded we don't disconnect the
* connection; we just sort of leave it hanging there until it times
* out or disconnects itself or is dropped due to the max number of
Index: dispatch.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/dispatch.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- dispatch.c 10 Aug 2004 03:06:59 -0000 1.61
+++ dispatch.c 17 Sep 2004 09:14:49 -0000 1.62
@@ -934,6 +934,96 @@
* but the correct thing may include OOM errors.
*/
static dbus_bool_t
+check_double_hello_message (BusContext *context,
+ DBusConnection *connection)
+{
+ DBusMessage *message;
+ dbus_uint32_t serial;
+ dbus_bool_t retval;
+ DBusError error;
+
+ retval = FALSE;
+ dbus_error_init (&error);
+ message = NULL;
+
+ _dbus_verbose ("check_double_hello_message for %p\n", connection);
+
+ message = dbus_message_new_method_call (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS,
+ DBUS_PATH_ORG_FREEDESKTOP_DBUS,
+ DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS,
+ "Hello");
+
+ if (message == NULL)
+ return TRUE;
+
+ if (!dbus_connection_send (connection, message, &serial))
+ {
+ dbus_message_unref (message);
+ return TRUE;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ /* send our message */
+ bus_test_run_clients_loop (TRUE);
+
+ dbus_connection_ref (connection); /* because we may get disconnected */
+ block_connection_until_message_from_bus (context, connection);
+
+ if (!dbus_connection_get_is_connected (connection))
+ {
+ _dbus_verbose ("connection was disconnected\n");
+
+ dbus_connection_unref (connection);
+
+ return TRUE;
+ }
+
+ dbus_connection_unref (connection);
+
+ message = pop_message_waiting_for_memory (connection);
+ if (message == NULL)
+ {
+ _dbus_warn ("Did not receive a reply to %s %d on %p\n",
+ "Hello", serial, connection);
+ goto out;
+ }
+
+ verbose_message_received (connection, message);
+
+ if (!dbus_message_has_sender (message, DBUS_SERVICE_ORG_FREEDESKTOP_DBUS))
+ {
+ _dbus_warn ("Message has wrong sender %s\n",
+ dbus_message_get_sender (message) ?
+ dbus_message_get_sender (message) : "(none)");
+ goto out;
+ }
+
+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
+ {
+ warn_unexpected (connection, message, "method return for Hello");
+ goto out;
+ }
+
+ if (!check_no_leftovers (context))
+ goto out;
+
+ retval = TRUE;
+
+ out:
+ dbus_error_free (&error);
+
+ if (message)
+ dbus_message_unref (message);
+
+ return retval;
+}
+
+/* returns TRUE if the correct thing happens,
+ * but the correct thing may include OOM errors.
+ */
+static dbus_bool_t
check_get_connection_unix_user (BusContext *context,
DBusConnection *connection)
{
@@ -2243,7 +2333,9 @@
; /* good, this is a valid response */
}
else if (dbus_message_is_error (message,
- DBUS_ERROR_SPAWN_CHILD_EXITED))
+ DBUS_ERROR_SPAWN_CHILD_EXITED) ||
+ dbus_message_is_error (message,
+ DBUS_ERROR_SPAWN_EXEC_FAILED))
{
; /* good, this is expected also */
}
@@ -2917,6 +3009,9 @@
if (!check_hello_message (context, foo))
_dbus_assert_not_reached ("hello message failed");
+ if (!check_double_hello_message (context, foo))
+ _dbus_assert_not_reached ("double hello message failed");
+
if (!check_add_match_all (context, foo))
_dbus_assert_not_reached ("AddMatch message failed");
More information about the dbus-commit
mailing list