Commit d6e1b2ad authored by Havoc Pennington's avatar Havoc Pennington

2003-10-16 Havoc Pennington <hp@redhat.com>

	* bus/connection.c (bus_pending_reply_expired): either cancel or
	execute, not both
	(bus_connections_check_reply): use unlink, not remove_link, as we
	don't want to free the link; fixes double free mess

	* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
	where no reply was received

	* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
	fix a refcount leak

	* bus/signals.c (match_rule_matches): add special cases for the
	bus driver, so you can match on sender/destination for it.

	* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
	DBUS_PRINT_BACKTRACE is set

	* dbus/dbus-internals.c: add pid to assertion failure messages

	* dbus/dbus-connection.c: add message type code to the debug spew

	* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
	sender=foo not service=foo

	* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
	session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
	DBUS_ACTIVATION_ADDRESS instead

	* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
	DBUS_SYSTEM_BUS_ADDRESS if appropriate

	* bus/bus.c (bus_context_new): handle OOM copying bus type into
	context struct

	* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
	(dbus_message_iter_get_object_path_array): new function (half
	finished, disabled for the moment)

	* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
	DBUS_MESSAGE_TYPE_ERROR

	* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
	avoid redirecting stderr to /dev/null
	(babysit): close stdin if not doing the "exit_with_session" thing

	* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
	debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
	stdout/stdin, so things don't get confused

	* bus/system.conf.in: fix to allow replies, I modified .conf
	instead of .conf.in again.
parent 9b9dd4b8
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
execute, not both
(bus_connections_check_reply): use unlink, not remove_link, as we
don't want to free the link; fixes double free mess
* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
where no reply was received
* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
fix a refcount leak
* bus/signals.c (match_rule_matches): add special cases for the
bus driver, so you can match on sender/destination for it.
* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
DBUS_PRINT_BACKTRACE is set
* dbus/dbus-internals.c: add pid to assertion failure messages
* dbus/dbus-connection.c: add message type code to the debug spew
* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
sender=foo not service=foo
* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
DBUS_ACTIVATION_ADDRESS instead
* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
DBUS_SYSTEM_BUS_ADDRESS if appropriate
* bus/bus.c (bus_context_new): handle OOM copying bus type into
context struct
* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
(dbus_message_iter_get_object_path_array): new function (half
finished, disabled for the moment)
* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
DBUS_MESSAGE_TYPE_ERROR
* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
avoid redirecting stderr to /dev/null
(babysit): close stdin if not doing the "exit_with_session" thing
* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
stdout/stdin, so things don't get confused
* bus/system.conf.in: fix to allow replies, I modified .conf
instead of .conf.in again.
2003-10-14 David Zeuthen <david@fubar.dk>
* python/dbus_bindings.pyx.in (MessageIter.get): fixed typo in
......
......@@ -482,12 +482,25 @@ child_setup (void *data)
*/
if (!_dbus_setenv ("DBUS_ACTIVATION_ADDRESS", activation->server_address))
_dbus_exit (1);
type = bus_context_get_type (activation->context);
if (type != NULL)
{
if (!_dbus_setenv ("DBUS_BUS_TYPE", type))
_dbus_exit (1);
if (strcmp (type, "session") == 0)
{
if (!_dbus_setenv ("DBUS_SESSION_BUS_ADDRESS",
activation->server_address))
_dbus_exit (1);
}
else if (strcmp (type, "system") == 0)
{
if (!_dbus_setenv ("DBUS_SYSTEM_BUS_ADDRESS",
activation->server_address))
_dbus_exit (1);
}
}
}
......
......@@ -37,6 +37,7 @@ struct BusContext
{
int refcount;
char *type;
char *bus_env_var;
char *address;
char *pidfile;
DBusLoop *loop;
......@@ -398,6 +399,11 @@ bus_context_new (const DBusString *config_file,
/* note that type may be NULL */
context->type = _dbus_strdup (bus_config_parser_get_type (parser));
if (bus_config_parser_get_type (parser) != NULL && context->type == NULL)
{
BUS_SET_OOM (error);
goto failed;
}
/* We have to build the address backward, so that
* <listen> later in the config file have priority
......
......@@ -54,7 +54,7 @@ struct BusConnections
BusContext *context;
DBusHashTable *completed_by_user; /**< Number of completed connections for each UID */
DBusTimeout *expire_timeout; /**< Timeout for expiring incomplete connections. */
int stamp; /**< Incrementing number */
int stamp; /**< Incrementing number */
BusExpireList *pending_replies; /**< List of pending replies */
};
......@@ -1340,6 +1340,18 @@ bus_connections_check_limits (BusConnections *connections,
return TRUE;
}
static void
bus_pending_reply_free (BusPendingReply *pending)
{
_dbus_verbose ("Freeing pending reply %p, replier %p receiver %p serial %u\n",
pending,
pending->will_send_reply,
pending->will_get_reply,
pending->reply_serial);
dbus_free (pending);
}
static dbus_bool_t
bus_pending_reply_send_no_reply (BusConnections *connections,
BusTransaction *transaction,
......@@ -1393,20 +1405,28 @@ bus_pending_reply_expired (BusExpireList *list,
* leave it in the list to try expiring again later when we
* get more memory.
*/
_dbus_verbose ("Expiring pending reply %p, replier %p receiver %p serial %u\n",
pending,
pending->will_send_reply,
pending->will_get_reply,
pending->reply_serial);
transaction = bus_transaction_new (connections->context);
if (transaction == NULL)
return;
if (bus_pending_reply_send_no_reply (connections,
transaction,
pending))
if (!bus_pending_reply_send_no_reply (connections,
transaction,
pending))
{
_dbus_list_remove_link (&connections->pending_replies->items,
link);
dbus_free (pending);
bus_transaction_cancel_and_free (transaction);
return;
}
_dbus_list_remove_link (&connections->pending_replies->items,
link);
bus_pending_reply_free (pending);
bus_transaction_execute_and_free (transaction);
}
......@@ -1418,6 +1438,9 @@ bus_connection_drop_pending_replies (BusConnections *connections,
* do anything with it except check for pointer equality
*/
DBusList *link;
_dbus_verbose ("Dropping pending replies that involve connection %p\n",
connection);
link = _dbus_list_get_first_link (&connections->pending_replies->items);
while (link != NULL)
......@@ -1433,16 +1456,27 @@ bus_connection_drop_pending_replies (BusConnections *connections,
{
/* We don't need to track this pending reply anymore */
_dbus_verbose ("Dropping pending reply %p, replier %p receiver %p serial %u\n",
pending,
pending->will_send_reply,
pending->will_get_reply,
pending->reply_serial);
_dbus_list_remove_link (&connections->pending_replies->items,
link);
dbus_free (pending);
bus_pending_reply_free (pending);
}
else if (pending->will_send_reply == connection)
{
/* The reply isn't going to be sent, so set things
* up so it will be expired right away
*/
_dbus_verbose ("Will expire pending reply %p, replier %p receiver %p serial %u\n",
pending,
pending->will_send_reply,
pending->will_get_reply,
pending->reply_serial);
pending->will_send_reply = NULL;
pending->expire_item.added_tv_sec = 0;
pending->expire_item.added_tv_usec = 0;
......@@ -1467,11 +1501,13 @@ cancel_pending_reply (void *data)
{
CancelPendingReplyData *d = data;
_dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
if (!_dbus_list_remove (&d->connections->pending_replies->items,
d->pending))
_dbus_assert_not_reached ("pending reply did not exist to be cancelled");
dbus_free (d->pending); /* since it's been cancelled */
bus_pending_reply_free (d->pending); /* since it's been cancelled */
}
static void
......@@ -1479,6 +1515,8 @@ cancel_pending_reply_data_free (void *data)
{
CancelPendingReplyData *d = data;
_dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
/* d->pending should be either freed or still
* in the list of pending replies (owned by someone
* else)
......@@ -1537,11 +1575,21 @@ bus_connections_expect_reply (BusConnections *connections,
return FALSE;
}
#ifdef DBUS_ENABLE_VERBOSE_MODE
/* so we can see a not-yet-added pending reply */
pending->expire_item.added_tv_sec = 1;
pending->expire_item.added_tv_usec = 1;
#endif
pending->will_get_reply = will_get_reply;
pending->will_send_reply = will_send_reply;
pending->reply_serial = reply_serial;
cprd = dbus_new0 (CancelPendingReplyData, 1);
if (cprd == NULL)
{
BUS_SET_OOM (error);
dbus_free (pending);
bus_pending_reply_free (pending);
return FALSE;
}
......@@ -1550,7 +1598,7 @@ bus_connections_expect_reply (BusConnections *connections,
{
BUS_SET_OOM (error);
dbus_free (cprd);
dbus_free (pending);
bus_pending_reply_free (pending);
return FALSE;
}
......@@ -1562,7 +1610,7 @@ bus_connections_expect_reply (BusConnections *connections,
BUS_SET_OOM (error);
_dbus_list_remove (&connections->pending_replies->items, pending);
dbus_free (cprd);
dbus_free (pending);
bus_pending_reply_free (pending);
return FALSE;
}
......@@ -1572,10 +1620,12 @@ bus_connections_expect_reply (BusConnections *connections,
_dbus_get_current_time (&pending->expire_item.added_tv_sec,
&pending->expire_item.added_tv_usec);
pending->will_get_reply = will_get_reply;
pending->will_send_reply = will_send_reply;
pending->reply_serial = reply_serial;
_dbus_verbose ("Added pending reply %p, replier %p receiver %p serial %u\n",
pending,
pending->will_send_reply,
pending->will_get_reply,
pending->reply_serial);
return TRUE;
}
......@@ -1590,6 +1640,8 @@ cancel_check_pending_reply (void *data)
{
CheckPendingReplyData *d = data;
_dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
_dbus_list_prepend_link (&d->connections->pending_replies->items,
d->link);
d->link = NULL;
......@@ -1600,11 +1652,16 @@ check_pending_reply_data_free (void *data)
{
CheckPendingReplyData *d = data;
_dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
if (d->link != NULL)
{
BusPendingReply *pending = d->link->data;
dbus_free (pending);
_dbus_assert (_dbus_list_find_last (&d->connections->pending_replies->items,
pending) == NULL);
bus_pending_reply_free (pending);
_dbus_list_free_link (d->link);
}
......@@ -1641,7 +1698,7 @@ bus_connections_check_reply (BusConnections *connections,
pending->will_get_reply == receiving_reply &&
pending->will_send_reply == sending_reply)
{
_dbus_verbose ("Found pending reply\n");
_dbus_verbose ("Found pending reply with serial %u\n", reply_serial);
break;
}
......@@ -1676,8 +1733,11 @@ bus_connections_check_reply (BusConnections *connections,
cprd->link = link;
cprd->connections = connections;
_dbus_list_remove_link (&connections->pending_replies->items,
link);
_dbus_list_unlink (&connections->pending_replies->items,
link);
_dbus_assert (_dbus_list_find_last (&connections->pending_replies->items,
link->data) == NULL);
return TRUE;
}
......@@ -2075,6 +2135,9 @@ bus_transaction_add_cancel_hook (BusTransaction *transaction,
ch = dbus_new (CancelHook, 1);
if (ch == NULL)
return FALSE;
_dbus_verbose (" adding cancel hook function = %p data = %p\n",
cancel_function, data);
ch->cancel_function = cancel_function;
ch->data = data;
......
......@@ -1006,6 +1006,8 @@ connection_is_primary_owner (DBusConnection *connection,
DBusString str;
BusRegistry *registry;
_dbus_assert (connection != NULL);
registry = bus_connection_get_registry (connection);
_dbus_string_init_const (&str, service_name);
......@@ -1028,6 +1030,11 @@ match_rule_matches (BusMatchRule *rule,
* so FALSE if any of them don't match.
*/
/* sender/addressed_recipient of #NULL may mean bus driver,
* or for addressed_recipient may mean a message with no
* specific recipient (i.e. a signal)
*/
if (rule->flags & BUS_MATCH_MESSAGE_TYPE)
{
_dbus_assert (rule->message_type != DBUS_MESSAGE_TYPE_INVALID);
......@@ -1068,8 +1075,17 @@ match_rule_matches (BusMatchRule *rule,
{
_dbus_assert (rule->sender != NULL);
if (!connection_is_primary_owner (sender, rule->sender))
return FALSE;
if (sender == NULL)
{
if (strcmp (rule->sender,
DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) != 0)
return FALSE;
}
else
{
if (!connection_is_primary_owner (sender, rule->sender))
return FALSE;
}
}
if (rule->flags & BUS_MATCH_DESTINATION)
......@@ -1078,15 +1094,21 @@ match_rule_matches (BusMatchRule *rule,
_dbus_assert (rule->destination != NULL);
if (addressed_recipient == NULL)
return FALSE;
destination = dbus_message_get_destination (message);
if (destination == NULL)
return FALSE;
if (!connection_is_primary_owner (addressed_recipient, rule->destination))
return FALSE;
if (addressed_recipient == NULL)
{
if (strcmp (rule->destination,
DBUS_SERVICE_ORG_FREEDESKTOP_DBUS) != 0)
return FALSE;
}
else
{
if (!connection_is_primary_owner (addressed_recipient, rule->destination))
return FALSE;
}
}
if (rule->flags & BUS_MATCH_PATH)
......
......@@ -44,6 +44,8 @@
even if they aren't in here -->
<allow send_destination="org.freedesktop.DBus"/>
<allow receive_sender="org.freedesktop.DBus"/>
<!-- valid replies are always allowed -->
<allow requested_reply="true"/>
</policy>
<!-- Config files are placed here that among other things, punch
......
......@@ -143,6 +143,8 @@ init_connections_unlocked (void)
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
{
_dbus_verbose ("Filling in system bus address...\n");
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_SYSTEM],
"DBUS_SYSTEM_BUS_ADDRESS"))
return FALSE;
......@@ -154,27 +156,44 @@ init_connections_unlocked (void)
_dbus_strdup (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS);
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
return FALSE;
_dbus_verbose (" used default system bus \"%s\"\n",
bus_connection_addresses[DBUS_BUS_SYSTEM]);
}
else
_dbus_verbose (" used env var system bus \"%s\"\n",
bus_connection_addresses[DBUS_BUS_SYSTEM]);
}
if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL)
{
_dbus_verbose ("Filling in session bus address...\n");
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_SESSION],
"DBUS_SESSION_BUS_ADDRESS"))
return FALSE;
_dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_SESSION] ?
bus_connection_addresses[DBUS_BUS_SESSION] : "none set");
}
if (bus_connection_addresses[DBUS_BUS_ACTIVATION] == NULL)
{
_dbus_verbose ("Filling in activation bus address...\n");
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_ACTIVATION],
"DBUS_ACTIVATION_ADDRESS"))
return FALSE;
_dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_ACTIVATION] ?
bus_connection_addresses[DBUS_BUS_ACTIVATION] : "none set");
}
s = _dbus_getenv ("DBUS_ACTIVATION_BUS_TYPE");
if (s != NULL)
{
_dbus_verbose ("Bus activation type was set to \"%s\"\n", s);
if (strcmp (s, "system") == 0)
activation_bus_type = DBUS_BUS_SYSTEM;
else if (strcmp (s, "session") == 0)
......@@ -311,10 +330,12 @@ dbus_bus_get (DBusBusType type,
address_type = type;
/* Use the real type of the activation bus for getting its
* connection. (If the activating bus isn't a well-known
* bus then activation_bus_type == DBUS_BUS_ACTIVATION)
* connection, but only if the real type's address is available. (If
* the activating bus isn't a well-known bus then
* activation_bus_type == DBUS_BUS_ACTIVATION)
*/
if (type == DBUS_BUS_ACTIVATION)
if (type == DBUS_BUS_ACTIVATION &&
bus_connection_addresses[activation_bus_type] != NULL)
type = activation_bus_type;
if (bus_connections[type] != NULL)
......
......@@ -344,11 +344,13 @@ _dbus_connection_queue_received_message_link (DBusConnection *connection,
_dbus_connection_wakeup_mainloop (connection);
_dbus_verbose ("Message %p (%s) added to incoming queue %p, %d incoming\n",
_dbus_verbose ("Message %p (%d %s '%s') added to incoming queue %p, %d incoming\n",
message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
dbus_message_get_signature (message),
connection,
connection->n_incoming);
}
......@@ -430,11 +432,13 @@ _dbus_connection_message_sent (DBusConnection *connection,
connection->n_outgoing -= 1;
_dbus_verbose ("Message %p (%s) removed from outgoing queue %p, %d left to send\n",
_dbus_verbose ("Message %p (%d %s '%s') removed from outgoing queue %p, %d left to send\n",
message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
dbus_message_get_signature (message),
connection, connection->n_outgoing);
/* Save this link in the link cache also */
......@@ -690,12 +694,20 @@ _dbus_pending_call_complete_and_unlock (DBusPendingCall *pending,
message = pending->timeout_link->data;
_dbus_list_clear (&pending->timeout_link);
}
else
dbus_message_ref (message);
_dbus_verbose (" handing message %p to pending call\n", message);
_dbus_verbose (" handing message %p (%s) to pending call serial %u\n",
message,
dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN ?
"method return" :
dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR ?
"error" : "other type",
pending->reply_serial);
_dbus_assert (pending->reply == NULL);
_dbus_assert (pending->reply_serial == dbus_message_get_reply_serial (message));
pending->reply = message;
dbus_message_ref (pending->reply);
dbus_pending_call_ref (pending); /* in case there's no app with a ref held */
_dbus_connection_detach_pending_call_and_unlock (pending->connection, pending);
......@@ -1505,11 +1517,13 @@ _dbus_connection_send_preallocated_unlocked (DBusConnection *connection,
connection->n_outgoing += 1;
_dbus_verbose ("Message %p (%s) added to outgoing queue %p, %d pending to send\n",
_dbus_verbose ("Message %p (%d %s '%s') added to outgoing queue %p, %d pending to send\n",
message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
dbus_message_get_signature (message),
connection,
connection->n_outgoing);
......@@ -2178,11 +2192,13 @@ _dbus_connection_pop_message_link_unlocked (DBusConnection *connection)
link = _dbus_list_pop_first_link (&connection->incoming_messages);
connection->n_incoming -= 1;
_dbus_verbose ("Message %p (%s) removed from incoming queue %p, %d incoming\n",
_dbus_verbose ("Message %p (%d %s '%s') removed from incoming queue %p, %d incoming\n",
link->data,
dbus_message_get_type (link->data),
dbus_message_get_interface (link->data) ?
dbus_message_get_interface (link->data) :
"no interface",
dbus_message_get_signature (link->data),
connection, connection->n_incoming);
return link;
......@@ -2227,11 +2243,13 @@ _dbus_connection_putback_message_link_unlocked (DBusConnection *connection,
message_link);
connection->n_incoming += 1;
_dbus_verbose ("Message %p (%s) put back into queue %p, %d incoming\n",
_dbus_verbose ("Message %p (%d %s '%s') put back into queue %p, %d incoming\n",
message_link->data,
dbus_message_get_type (message_link->data),
dbus_message_get_interface (message_link->data) ?
dbus_message_get_interface (message_link->data) :
"no interface",
dbus_message_get_signature (message_link->data),
connection, connection->n_incoming);
}
......@@ -2558,8 +2576,9 @@ dbus_connection_dispatch (DBusConnection *connection)
/* We're still protected from dispatch() reentrancy here
* since we acquired the dispatcher
*/
_dbus_verbose (" running object path dispatch on message %p (%s)\n",
_dbus_verbose (" running object path dispatch on message %p (%d %s '%s')\n",
message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface");
......@@ -2625,15 +2644,19 @@ dbus_connection_dispatch (DBusConnection *connection)
result = DBUS_HANDLER_RESULT_HANDLED;
}
_dbus_verbose (" done dispatching %p (%s) on connection %p\n", message,
_dbus_verbose (" done dispatching %p (%d %s '%s') on connection %p\n", message,
dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
dbus_message_get_signature (message),
connection);
out:
if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
{
_dbus_verbose ("out of memory in %s\n", _DBUS_FUNCTION_NAME);
/* Put message back, and we'll start over.
* Yes this means handlers must be idempotent if they
* don't return HANDLED; c'est la vie.
......@@ -2643,6 +2666,8 @@ dbus_connection_dispatch (DBusConnection *connection)
}
else
{
_dbus_verbose ("Done with message in %s\n", _DBUS_FUNCTION_NAME);
if (connection->exit_on_disconnect &&
dbus_message_is_signal (message,
DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
......
......@@ -223,6 +223,8 @@ _dbus_verbose_real (const char *format,
va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
fflush (stderr);
}
/**
......@@ -424,7 +426,7 @@ _dbus_header_field_to_string (int header_field)
#ifndef DBUS_DISABLE_CHECKS
/** String used in _dbus_return_if_fail macro */
const char _dbus_return_if_fail_warning_format[] =
"Arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\n"
"%lu: arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\n"
"This is normally a bug in some application using the D-BUS library.\n";
#endif
......@@ -448,8 +450,8 @@ _dbus_real_assert (dbus_bool_t condition,
{
if (!condition)
{
_dbus_warn ("Assertion failed \"%s\" file \"%s\" line %d process %lu\n",
condition_text, file, line, _dbus_getpid ());
_dbus_warn ("%lu: assertion failed \"%s\" file \"%s\" line %d\n",
_dbus_getpid (), condition_text, file, line);
_dbus_abort ();
}
}
......
......@@ -94,18 +94,18 @@ void _dbus_real_assert_not_reached (const char *explanation,
#else
extern const char _dbus_return_if_fail_warning_format[];
#define _dbus_return_if_fail(condition) do { \
if (!(condition)) { \
_dbus_warn (_dbus_return_if_fail_warning_format, \
_DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
return; \
#define _dbus_return_if_fail(condition) do { \
if (!(condition)) { \
_dbus_warn (_dbus_return_if_fail_warning_format, \
_dbus_getpid (), _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
return; \
} } while (0)
#define _dbus_return_val_if_fail(condition, val) do { \
if (!(condition)) { \
_dbus_warn (_dbus_return_if_fail_warning_format, \
_DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
return (val); \
#define _dbus_return_val_if_fail(condition, val) do { \
if (!(condition)) { \
_dbus_warn (_dbus_return_if_fail_warning_format, \
_dbus_getpid (), _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
return (val); \
} } while (0)
#endif /* !DBUS_DISABLE_ASSERT */
......
......@@ -1870,6 +1870,9 @@ dbus_message_append_args_valist (DBusMessage *message,
if (!dbus_message_iter_append_string (&iter, va_arg (var_args, const char *)))
goto errorout;
break;
case DBUS_TYPE_OBJECT_PATH:
break;
case DBUS_TYPE_NAMED:
{
const char *name;
......@@ -2540,7 +2543,10 @@ dbus_message_iter_get_arg_type (DBusMessageIter *iter)
_dbus_return_val_if_fail (dbus_message_iter_check (real), DBUS_TYPE_INVALID);
if (real->pos >= real->end)
return DBUS_TYPE_INVALID;
{
_dbus_verbose (" iterator at or beyond end of message\n");
return DBUS_TYPE_INVALID;
}
pos = dbus_message_iter_get_data_start (real, &type);
......@@ -2645,6 +2651,36 @@ dbus_message_iter_get_string (DBusMessageIter *iter)
pos, NULL);
}
#if 0
/**
* @todo FIXME to finish this _dbus_demarshal_object_path() needs
* to not explode the path.
*
* Returns the object path value that an iterator may point to.
* Note that you need to check that the iterator points to
* an object path value before using this function.
*
* @see dbus_message_iter_get_arg_type
* @param iter the message iter
* @returns the path
*/
char *
dbus_message_iter_get_object_path (DBusMessageIter *iter)
{
DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
int type, pos;
_dbus_return_val_if_fail (dbus_message_iter_check (real), NULL);
pos = dbus_message_iter_get_data_start (real, &type);
_dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
return _dbus_demarshal_object_path (&real->message->body, real->message->byte_order,
pos, NULL);
}
#endif
/**
* Returns the name and data from a named type that an
* iterator may point to. Note that you need to check that
......@@ -3226,7 +3262,7 @@ dbus_message_iter_get_double_array (DBusMessageIter *iter,
/**
* Returns the string array that the iterator may point to.
* Note that you need to check that the iterator points
* to a byte array prior to using this function.
* to a string array prior to using this function.
*
* The returned value is a #NULL-terminated array of strings.
* Each string is a separate malloc block, and the array
......@@ -3262,6 +3298,50 @@ dbus_message_iter_get_string_array (DBusMessageIter *iter,
return TRUE;