-/* -*- mode: C; c-file-style: "gnu" -*- */
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* driver.c Bus client (driver)
*
* Copyright (C) 2003 CodeFactory AB
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
+#include <config.h>
#include "activation.h"
#include "connection.h"
#include "driver.h"
#include "utils.h"
#include <dbus/dbus-string.h>
#include <dbus/dbus-internals.h>
+#include <dbus/dbus-message.h>
#include <dbus/dbus-marshal-recursive.h>
#include <string.h>
/* Create the service */
service = bus_registry_ensure (registry,
- &unique_name, connection, transaction, error);
+ &unique_name, connection, 0, transaction, error);
if (service == NULL)
goto out_0;
- bus_service_set_prohibit_replacement (service, TRUE);
-
_dbus_assert (bus_connection_is_active (connection));
retval = TRUE;
++i;
}
+ dbus_free_string_array (services);
+
if (!dbus_message_iter_close_container (&iter, &sub))
{
- dbus_free_string_array (services);
dbus_message_unref (reply);
BUS_SET_OOM (error);
return FALSE;
}
+ if (!bus_transaction_send_from_driver (transaction, connection, reply))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+ else
+ {
+ dbus_message_unref (reply);
+ return TRUE;
+ }
+}
+
+static dbus_bool_t
+bus_driver_handle_list_activatable_services (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ DBusMessage *reply;
+ int len;
+ char **services;
+ BusActivation *activation;
+ int i;
+ DBusMessageIter iter;
+ DBusMessageIter sub;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ activation = bus_connection_get_activation (connection);
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ if (!bus_activation_list_services (activation, &services, &len))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ dbus_message_iter_init_append (reply, &iter);
+
+ if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING,
+ &sub))
+ {
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ {
+ /* Include the bus driver in the list */
+ const char *v_STRING = DBUS_SERVICE_DBUS;
+ if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
+ &v_STRING))
+ {
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+ }
+
+ i = 0;
+ while (i < len)
+ {
+ if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
+ &services[i]))
+ {
+ dbus_free_string_array (services);
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+ ++i;
+ }
+
dbus_free_string_array (services);
-
+
+ if (!dbus_message_iter_close_container (&iter, &sub))
+ {
+ dbus_message_unref (reply);
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
if (!bus_transaction_send_from_driver (transaction, connection, reply))
{
dbus_message_unref (reply);
{
DBusMessage *reply;
+ if (dbus_message_get_no_reply (message))
+ return TRUE;
+
reply = dbus_message_new_method_return (message);
if (reply == NULL)
{
}
static dbus_bool_t
+bus_driver_handle_update_activation_environment (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ dbus_bool_t retval;
+ BusActivation *activation;
+ DBusMessageIter iter;
+ DBusMessageIter dict_iter;
+ DBusMessageIter dict_entry_iter;
+ int msg_type;
+ int array_type;
+ int key_type;
+ DBusList *keys, *key_link;
+ DBusList *values, *value_link;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ activation = bus_connection_get_activation (connection);
+
+ dbus_message_iter_init (message, &iter);
+
+ /* The message signature has already been checked for us,
+ * so let's just assert it's right.
+ */
+ msg_type = dbus_message_iter_get_arg_type (&iter);
+
+ _dbus_assert (msg_type == DBUS_TYPE_ARRAY);
+
+ dbus_message_iter_recurse (&iter, &dict_iter);
+
+ retval = FALSE;
+
+ /* Then loop through the sent dictionary, add the location of
+ * the environment keys and values to lists. The result will
+ * be in reverse order, so we don't have to constantly search
+ * for the end of the list in a loop.
+ */
+ keys = NULL;
+ values = NULL;
+ while ((array_type = dbus_message_iter_get_arg_type (&dict_iter)) == DBUS_TYPE_DICT_ENTRY)
+ {
+ dbus_message_iter_recurse (&dict_iter, &dict_entry_iter);
+
+ while ((key_type = dbus_message_iter_get_arg_type (&dict_entry_iter)) == DBUS_TYPE_STRING)
+ {
+ char *key;
+ char *value;
+ int value_type;
+
+ dbus_message_iter_get_basic (&dict_entry_iter, &key);
+ dbus_message_iter_next (&dict_entry_iter);
+
+ value_type = dbus_message_iter_get_arg_type (&dict_entry_iter);
+
+ if (value_type != DBUS_TYPE_STRING)
+ break;
+
+ dbus_message_iter_get_basic (&dict_entry_iter, &value);
+
+ if (!_dbus_list_append (&keys, key))
+ {
+ BUS_SET_OOM (error);
+ break;
+ }
+
+ if (!_dbus_list_append (&values, value))
+ {
+ BUS_SET_OOM (error);
+ break;
+ }
+
+ dbus_message_iter_next (&dict_entry_iter);
+ }
+
+ if (key_type != DBUS_TYPE_INVALID)
+ break;
+
+ dbus_message_iter_next (&dict_iter);
+ }
+
+ if (array_type != DBUS_TYPE_INVALID)
+ goto out;
+
+ _dbus_assert (_dbus_list_get_length (&keys) == _dbus_list_get_length (&values));
+
+ key_link = keys;
+ value_link = values;
+ while (key_link != NULL)
+ {
+ const char *key;
+ const char *value;
+
+ key = key_link->data;
+ value = value_link->data;
+
+ if (!bus_activation_set_environment_variable (activation,
+ key, value, error))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ _dbus_verbose ("bus_activation_set_environment_variable() failed\n");
+ break;
+ }
+ key_link = _dbus_list_get_next_link (&keys, key_link);
+ value_link = _dbus_list_get_next_link (&values, value_link);
+ }
+
+ /* FIXME: We can fail early having set only some of the environment variables,
+ * (because of OOM failure). It's sort of hard to fix and it doesn't really
+ * matter, so we're punting for now.
+ */
+ if (key_link != NULL)
+ goto out;
+
+ if (!send_ack_reply (connection, transaction,
+ message, error))
+ goto out;
+
+ retval = TRUE;
+
+ out:
+ _dbus_list_clear (&keys);
+ _dbus_list_clear (&values);
+ return retval;
+}
+
+static dbus_bool_t
bus_driver_handle_add_match (DBusConnection *connection,
BusTransaction *transaction,
DBusMessage *message,
}
else
{
- base_name = bus_connection_get_name (bus_service_get_primary_owner (service));
+ base_name = bus_connection_get_name (bus_service_get_primary_owners_connection (service));
if (base_name == NULL)
{
/* FIXME - how is this error possible? */
}
static dbus_bool_t
+bus_driver_handle_list_queued_owners (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ const char *text;
+ DBusList *base_names;
+ DBusList *link;
+ DBusString str;
+ BusRegistry *registry;
+ BusService *service;
+ DBusMessage *reply;
+ DBusMessageIter iter, array_iter;
+ char *dbus_service_name = DBUS_SERVICE_DBUS;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ registry = bus_connection_get_registry (connection);
+
+ base_names = NULL;
+ text = NULL;
+ reply = NULL;
+
+ if (! dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &text,
+ DBUS_TYPE_INVALID))
+ goto failed;
+
+ _dbus_string_init_const (&str, text);
+ service = bus_registry_lookup (registry, &str);
+ if (service == NULL &&
+ _dbus_string_equal_c_str (&str, DBUS_SERVICE_DBUS))
+ {
+ /* ORG_FREEDESKTOP_DBUS owns itself */
+ if (! _dbus_list_append (&base_names, dbus_service_name))
+ goto oom;
+ }
+ else if (service == NULL)
+ {
+ dbus_set_error (error,
+ DBUS_ERROR_NAME_HAS_NO_OWNER,
+ "Could not get owners of name '%s': no such name", text);
+ goto failed;
+ }
+ else
+ {
+ if (!bus_service_list_queued_owners (service,
+ &base_names,
+ error))
+ goto failed;
+ }
+
+ _dbus_assert (base_names != NULL);
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ goto oom;
+
+ dbus_message_iter_init_append (reply, &iter);
+ if (!dbus_message_iter_open_container (&iter,
+ DBUS_TYPE_ARRAY,
+ DBUS_TYPE_STRING_AS_STRING,
+ &array_iter))
+ goto oom;
+
+ link = _dbus_list_get_first_link (&base_names);
+ while (link != NULL)
+ {
+ char *uname;
+
+ _dbus_assert (link->data != NULL);
+ uname = (char *)link->data;
+
+ if (!dbus_message_iter_append_basic (&array_iter,
+ DBUS_TYPE_STRING,
+ &uname))
+ goto oom;
+
+ link = _dbus_list_get_next_link (&base_names, link);
+ }
+
+ if (! dbus_message_iter_close_container (&iter, &array_iter))
+ goto oom;
+
+
+ if (! bus_transaction_send_from_driver (transaction, connection, reply))
+ goto oom;
+
+ dbus_message_unref (reply);
+
+ return TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+
+ failed:
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+
+ if (base_names)
+ _dbus_list_clear (&base_names);
+
+ return FALSE;
+}
+
+static dbus_bool_t
bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
BusTransaction *transaction,
DBusMessage *message,
goto failed;
}
- conn = bus_service_get_primary_owner (serv);
+ conn = bus_service_get_primary_owners_connection (serv);
reply = dbus_message_new_method_return (message);
if (reply == NULL)
goto failed;
}
- conn = bus_service_get_primary_owner (serv);
+ conn = bus_service_get_primary_owners_connection (serv);
reply = dbus_message_new_method_return (message);
if (reply == NULL)
}
static dbus_bool_t
+bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ const char *service;
+ DBusString str;
+ BusRegistry *registry;
+ BusService *serv;
+ DBusConnection *conn;
+ DBusMessage *reply;
+ void *data = NULL;
+ dbus_uint32_t data_size;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ registry = bus_connection_get_registry (connection);
+
+ service = NULL;
+ reply = NULL;
+
+ if (! dbus_message_get_args (message, error,
+ DBUS_TYPE_STRING, &service,
+ DBUS_TYPE_INVALID))
+ goto failed;
+
+ _dbus_verbose ("asked for audit session data for connection %s\n", service);
+
+ _dbus_string_init_const (&str, service);
+ serv = bus_registry_lookup (registry, &str);
+ if (serv == NULL)
+ {
+ dbus_set_error (error,
+ DBUS_ERROR_NAME_HAS_NO_OWNER,
+ "Could not get audit session data for name '%s': no such name", service);
+ goto failed;
+ }
+
+ conn = bus_service_get_primary_owners_connection (serv);
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ goto oom;
+
+ if (!dbus_connection_get_adt_audit_session_data (conn, &data, &data_size) || data == NULL)
+ {
+ dbus_set_error (error,
+ DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN,
+ "Could not determine audit session data for '%s'", service);
+ goto failed;
+ }
+
+ if (! dbus_message_append_args (reply,
+ DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &data, data_size,
+ DBUS_TYPE_INVALID))
+ goto oom;
+
+ if (! bus_transaction_send_from_driver (transaction, connection, reply))
+ goto oom;
+
+ dbus_message_unref (reply);
+
+ return TRUE;
+
+ oom:
+ BUS_SET_OOM (error);
+
+ failed:
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ if (reply)
+ dbus_message_unref (reply);
+ return FALSE;
+}
+
+static dbus_bool_t
bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection,
BusTransaction *transaction,
DBusMessage *message,
goto failed;
}
- conn = bus_service_get_primary_owner (serv);
+ conn = bus_service_get_primary_owners_connection (serv);
reply = dbus_message_new_method_return (message);
if (reply == NULL)
return FALSE;
}
+static dbus_bool_t
+bus_driver_handle_get_id (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ BusContext *context;
+ DBusMessage *reply;
+ DBusString uuid;
+ const char *v_STRING;
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ if (!_dbus_string_init (&uuid))
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ reply = NULL;
+
+ context = bus_connection_get_context (connection);
+ if (!bus_context_get_id (context, &uuid))
+ goto oom;
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ goto oom;
+
+ v_STRING = _dbus_string_get_const_data (&uuid);
+ if (!dbus_message_append_args (reply,
+ DBUS_TYPE_STRING, &v_STRING,
+ DBUS_TYPE_INVALID))
+ goto oom;
+
+ _dbus_assert (dbus_message_has_signature (reply, "s"));
+
+ if (! bus_transaction_send_from_driver (transaction, connection, reply))
+ goto oom;
+
+ _dbus_string_free (&uuid);
+ dbus_message_unref (reply);
+ return TRUE;
+
+ oom:
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ BUS_SET_OOM (error);
+
+ if (reply)
+ dbus_message_unref (reply);
+ _dbus_string_free (&uuid);
+ return FALSE;
+}
+
/* For speed it might be useful to sort this in order of
* frequency of use (but doesn't matter with only a few items
* anyhow)
*/
-struct
+static struct
{
const char *name;
const char *in_args;
DBusMessage *message,
DBusError *error);
} message_handlers[] = {
+ { "Hello",
+ "",
+ DBUS_TYPE_STRING_AS_STRING,
+ bus_driver_handle_hello },
{ "RequestName",
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING,
DBUS_TYPE_UINT32_AS_STRING,
DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING,
DBUS_TYPE_UINT32_AS_STRING,
bus_driver_handle_activate_service },
- { "Hello",
+ { "UpdateActivationEnvironment",
+ DBUS_TYPE_ARRAY_AS_STRING DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
"",
- DBUS_TYPE_STRING_AS_STRING,
- bus_driver_handle_hello },
+ bus_driver_handle_update_activation_environment },
{ "NameHasOwner",
DBUS_TYPE_STRING_AS_STRING,
DBUS_TYPE_BOOLEAN_AS_STRING,
"",
DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
bus_driver_handle_list_services },
+ { "ListActivatableNames",
+ "",
+ DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
+ bus_driver_handle_list_activatable_services },
{ "AddMatch",
DBUS_TYPE_STRING_AS_STRING,
"",
DBUS_TYPE_STRING_AS_STRING,
DBUS_TYPE_STRING_AS_STRING,
bus_driver_handle_get_service_owner },
+ { "ListQueuedOwners",
+ DBUS_TYPE_STRING_AS_STRING,
+ DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
+ bus_driver_handle_list_queued_owners },
{ "GetConnectionUnixUser",
DBUS_TYPE_STRING_AS_STRING,
DBUS_TYPE_UINT32_AS_STRING,
DBUS_TYPE_STRING_AS_STRING,
DBUS_TYPE_UINT32_AS_STRING,
bus_driver_handle_get_connection_unix_process_id },
+ { "GetAdtAuditSessionData",
+ DBUS_TYPE_STRING_AS_STRING,
+ DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING,
+ bus_driver_handle_get_adt_audit_session_data },
{ "GetConnectionSELinuxSecurityContext",
DBUS_TYPE_STRING_AS_STRING,
DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING,
{ "ReloadConfig",
"",
"",
- bus_driver_handle_reload_config }
+ bus_driver_handle_reload_config },
+ { "GetId",
+ "",
+ DBUS_TYPE_STRING_AS_STRING,
+ bus_driver_handle_get_id }
};
static dbus_bool_t
return FALSE;
}
-static dbus_bool_t
-bus_driver_handle_introspect (DBusConnection *connection,
- BusTransaction *transaction,
- DBusMessage *message,
- DBusError *error)
+dbus_bool_t
+bus_driver_generate_introspect_string (DBusString *xml)
{
- DBusString xml;
- DBusMessage *reply;
- const char *v_STRING;
int i;
- _dbus_verbose ("Introspect() on bus driver\n");
-
- _DBUS_ASSERT_ERROR_IS_CLEAR (error);
-
- reply = NULL;
-
- if (! dbus_message_get_args (message, error,
- DBUS_TYPE_INVALID))
- {
- _DBUS_ASSERT_ERROR_IS_SET (error);
- return FALSE;
- }
-
- if (!_dbus_string_init (&xml))
- {
- BUS_SET_OOM (error);
- return FALSE;
- }
-
- if (!_dbus_string_append (&xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE))
- goto oom;
- if (!_dbus_string_append (&xml, "<node>\n"))
- goto oom;
- if (!_dbus_string_append_printf (&xml, " <interface name=\"%s\">\n", DBUS_INTERFACE_INTROSPECTABLE))
- goto oom;
- if (!_dbus_string_append (&xml, " <method name=\"Introspect\">\n"))
- goto oom;
- if (!_dbus_string_append_printf (&xml, " <arg name=\"data\" direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
- goto oom;
- if (!_dbus_string_append (&xml, " </method>\n"))
- goto oom;
- if (!_dbus_string_append (&xml, " </interface>\n"))
- goto oom;
+ if (!_dbus_string_append (xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE))
+ return FALSE;
+ if (!_dbus_string_append (xml, "<node>\n"))
+ return FALSE;
+ if (!_dbus_string_append_printf (xml, " <interface name=\"%s\">\n", DBUS_INTERFACE_INTROSPECTABLE))
+ return FALSE;
+ if (!_dbus_string_append (xml, " <method name=\"Introspect\">\n"))
+ return FALSE;
+ if (!_dbus_string_append_printf (xml, " <arg name=\"data\" direction=\"out\" type=\"%s\"/>\n", DBUS_TYPE_STRING_AS_STRING))
+ return FALSE;
+ if (!_dbus_string_append (xml, " </method>\n"))
+ return FALSE;
+ if (!_dbus_string_append (xml, " </interface>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <interface name=\"%s\">\n",
+ if (!_dbus_string_append_printf (xml, " <interface name=\"%s\">\n",
DBUS_INTERFACE_DBUS))
- goto oom;
+ return FALSE;
i = 0;
while (i < _DBUS_N_ELEMENTS (message_handlers))
{
- if (!_dbus_string_append_printf (&xml, " <method name=\"%s\">\n",
+ if (!_dbus_string_append_printf (xml, " <method name=\"%s\">\n",
message_handlers[i].name))
- goto oom;
+ return FALSE;
- if (!write_args_for_direction (&xml, message_handlers[i].in_args, TRUE))
- goto oom;
+ if (!write_args_for_direction (xml, message_handlers[i].in_args, TRUE))
+ return FALSE;
- if (!write_args_for_direction (&xml, message_handlers[i].out_args, FALSE))
- goto oom;
+ if (!write_args_for_direction (xml, message_handlers[i].out_args, FALSE))
+ return FALSE;
- if (!_dbus_string_append (&xml, " </method>\n"))
- goto oom;
+ if (!_dbus_string_append (xml, " </method>\n"))
+ return FALSE;
++i;
}
- if (!_dbus_string_append_printf (&xml, " <signal name=\"NameOwnerChanged\">\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <signal name=\"NameOwnerChanged\">\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <arg type=\"s\"/>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <arg type=\"s\"/>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <arg type=\"s\"/>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " </signal>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " </signal>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <signal name=\"NameLost\">\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <signal name=\"NameLost\">\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <arg type=\"s\"/>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " </signal>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " </signal>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <signal name=\"NameAcquired\">\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <signal name=\"NameAcquired\">\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
- goto oom;
+ if (!_dbus_string_append_printf (xml, " <arg type=\"s\"/>\n"))
+ return FALSE;
- if (!_dbus_string_append_printf (&xml, " </signal>\n"))
- goto oom;
-
+ if (!_dbus_string_append_printf (xml, " </signal>\n"))
+ return FALSE;
+ if (!_dbus_string_append (xml, " </interface>\n"))
+ return FALSE;
- if (!_dbus_string_append (&xml, " </interface>\n"))
- goto oom;
+ if (!_dbus_string_append (xml, "</node>\n"))
+ return FALSE;
+
+ return TRUE;
+}
+
+static dbus_bool_t
+bus_driver_handle_introspect (DBusConnection *connection,
+ BusTransaction *transaction,
+ DBusMessage *message,
+ DBusError *error)
+{
+ DBusString xml;
+ DBusMessage *reply;
+ const char *v_STRING;
+
+ _dbus_verbose ("Introspect() on bus driver\n");
- if (!_dbus_string_append (&xml, "</node>\n"))
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ reply = NULL;
+
+ if (! dbus_message_get_args (message, error,
+ DBUS_TYPE_INVALID))
+ {
+ _DBUS_ASSERT_ERROR_IS_SET (error);
+ return FALSE;
+ }
+
+ if (!_dbus_string_init (&xml))
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
+
+ if (!bus_driver_generate_introspect_string (&xml))
goto oom;
+ v_STRING = _dbus_string_get_const_data (&xml);
+
reply = dbus_message_new_method_return (message);
if (reply == NULL)
goto oom;
- v_STRING = _dbus_string_get_const_data (&xml);
if (! dbus_message_append_args (reply,
DBUS_TYPE_STRING, &v_STRING,
DBUS_TYPE_INVALID))
void
bus_driver_remove_connection (DBusConnection *connection)
{
- /* FIXME Does nothing for now, should unregister the connection
+ /* FIXME 1.0 Does nothing for now, should unregister the connection
* with the bus driver.
*/
}