1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* driver.c Bus client (driver)
4 * Copyright (C) 2003 CodeFactory AB
5 * Copyright (C) 2003, 2004, 2005 Red Hat, Inc.
6 * Copyright (C) 2013 Samsung Electronics
8 * Licensed under the Academic Free License version 2.1
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "activation.h"
28 #include "connection.h"
37 #include <dbus/dbus-asv-util.h>
38 #include <dbus/dbus-string.h>
39 #include <dbus/dbus-internals.h>
40 #include <dbus/dbus-message.h>
41 #include <dbus/dbus-marshal-recursive.h>
44 #ifdef ENABLE_KDBUS_TRANSPORT
52 static DBusConnection *
53 bus_driver_get_conn_helper (DBusConnection *connection,
55 const char *what_we_want,
60 BusRegistry *registry;
65 if (!dbus_message_get_args (message, error,
66 DBUS_TYPE_STRING, &name,
70 _dbus_assert (name != NULL);
71 _dbus_verbose ("asked for %s of connection %s\n", what_we_want, name);
73 registry = bus_connection_get_registry (connection);
74 _dbus_string_init_const (&str, name);
75 serv = bus_registry_lookup (registry, &str);
79 dbus_set_error (error, DBUS_ERROR_NAME_HAS_NO_OWNER,
80 "Could not get %s of name '%s': no such name",
85 conn = bus_service_get_primary_owners_connection (serv);
86 _dbus_assert (conn != NULL);
94 static dbus_bool_t bus_driver_send_welcome_message (DBusConnection *connection,
95 DBusMessage *hello_message,
96 BusTransaction *transaction,
100 bus_driver_send_service_owner_changed (const char *service_name,
101 const char *old_owner,
102 const char *new_owner,
103 BusTransaction *transaction,
106 DBusMessage *message;
108 const char *null_service;
110 #ifdef ENABLE_KDBUS_TRANSPORT
111 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
115 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
118 _dbus_verbose ("sending name owner changed: %s [%s -> %s]\n",
120 old_owner ? old_owner : null_service,
121 new_owner ? new_owner : null_service);
123 message = dbus_message_new_signal (DBUS_PATH_DBUS,
133 if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS))
136 if (!dbus_message_append_args (message,
137 DBUS_TYPE_STRING, &service_name,
138 DBUS_TYPE_STRING, old_owner ? &old_owner : &null_service,
139 DBUS_TYPE_STRING, new_owner ? &new_owner : &null_service,
143 _dbus_assert (dbus_message_has_signature (message, "sss"));
145 retval = bus_dispatch_matches (transaction, NULL, NULL, message, error);
146 dbus_message_unref (message);
151 dbus_message_unref (message);
157 bus_driver_send_service_lost (DBusConnection *connection,
158 const char *service_name,
159 BusTransaction *transaction,
162 DBusMessage *message;
164 #ifdef ENABLE_KDBUS_TRANSPORT
165 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
169 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
171 message = dbus_message_new_signal (DBUS_PATH_DBUS,
181 if (!dbus_message_set_destination (message, bus_connection_get_name (connection)) ||
182 !dbus_message_append_args (message,
183 DBUS_TYPE_STRING, &service_name,
186 dbus_message_unref (message);
191 if (!bus_transaction_send_from_driver (transaction, connection, message))
193 dbus_message_unref (message);
199 dbus_message_unref (message);
205 bus_driver_send_service_acquired (DBusConnection *connection,
206 const char *service_name,
207 BusTransaction *transaction,
210 DBusMessage *message;
212 #ifdef ENABLE_KDBUS_TRANSPORT
213 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
217 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
219 message = dbus_message_new_signal (DBUS_PATH_DBUS,
229 if (!dbus_message_set_destination (message, bus_connection_get_name (connection)) ||
230 !dbus_message_append_args (message,
231 DBUS_TYPE_STRING, &service_name,
234 dbus_message_unref (message);
239 if (!bus_transaction_send_from_driver (transaction, connection, message))
241 dbus_message_unref (message);
247 dbus_message_unref (message);
253 create_unique_client_name (BusRegistry *registry,
256 /* We never want to use the same unique client name twice, because
257 * we want to guarantee that if you send a message to a given unique
258 * name, you always get the same application. So we use two numbers
259 * for INT_MAX * INT_MAX combinations, should be pretty safe against
262 /* FIXME these should be in BusRegistry rather than static vars */
263 static int next_major_number = 0;
264 static int next_minor_number = 0;
267 len = _dbus_string_get_length (str);
271 /* start out with 1-0, go to 1-1, 1-2, 1-3,
272 * up to 1-MAXINT, then 2-0, 2-1, etc.
274 if (next_minor_number <= 0)
276 next_major_number += 1;
277 next_minor_number = 0;
278 if (next_major_number <= 0)
279 _dbus_assert_not_reached ("INT_MAX * INT_MAX clients were added");
282 _dbus_assert (next_major_number > 0);
283 _dbus_assert (next_minor_number >= 0);
285 /* appname:MAJOR-MINOR */
287 if (!_dbus_string_append (str, ":"))
290 if (!_dbus_string_append_int (str, next_major_number))
293 if (!_dbus_string_append (str, "."))
296 if (!_dbus_string_append_int (str, next_minor_number))
299 next_minor_number += 1;
301 /* Check if a client with the name exists */
302 if (bus_registry_lookup (registry, str) == NULL)
305 /* drop the number again, try the next one. */
306 _dbus_string_set_length (str, len);
313 bus_driver_handle_hello (DBusConnection *connection,
314 BusTransaction *transaction,
315 DBusMessage *message,
318 DBusString unique_name;
321 BusRegistry *registry;
322 BusConnections *connections;
324 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
326 if (bus_connection_is_active (connection))
328 /* We already handled an Hello message for this connection. */
329 dbus_set_error (error, DBUS_ERROR_FAILED,
330 "Already handled an Hello message");
334 /* Note that when these limits are exceeded we don't disconnect the
335 * connection; we just sort of leave it hanging there until it times
336 * out or disconnects itself or is dropped due to the max number of
337 * incomplete connections. It's even OK if the connection wants to
338 * retry the hello message, we support that.
340 connections = bus_connection_get_connections (connection);
341 if (!bus_connections_check_limits (connections, connection,
344 _DBUS_ASSERT_ERROR_IS_SET (error);
348 if (!_dbus_string_init (&unique_name))
356 registry = bus_connection_get_registry (connection);
358 if (!create_unique_client_name (registry, &unique_name))
364 if (!bus_connection_complete (connection, &unique_name, error))
366 _DBUS_ASSERT_ERROR_IS_SET (error);
370 if (!dbus_message_set_sender (message,
371 bus_connection_get_name (connection)))
377 if (!bus_driver_send_welcome_message (connection, message, transaction, error))
380 /* Create the service */
381 service = bus_registry_ensure (registry,
382 &unique_name, connection, 0, transaction, error);
386 _dbus_assert (bus_connection_is_active (connection));
390 _dbus_string_free (&unique_name);
395 bus_driver_send_welcome_message (DBusConnection *connection,
396 DBusMessage *hello_message,
397 BusTransaction *transaction,
400 DBusMessage *welcome;
403 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
405 name = bus_connection_get_name (connection);
406 _dbus_assert (name != NULL);
408 welcome = dbus_message_new_method_return (hello_message);
415 if (!dbus_message_append_args (welcome,
416 DBUS_TYPE_STRING, &name,
419 dbus_message_unref (welcome);
424 _dbus_assert (dbus_message_has_signature (welcome, DBUS_TYPE_STRING_AS_STRING));
426 if (!bus_transaction_send_from_driver (transaction, connection, welcome))
428 dbus_message_unref (welcome);
434 dbus_message_unref (welcome);
440 bus_driver_handle_list_services (DBusConnection *connection,
441 BusTransaction *transaction,
442 DBusMessage *message,
448 BusRegistry *registry;
450 DBusMessageIter iter;
453 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
455 registry = bus_connection_get_registry (connection);
457 reply = dbus_message_new_method_return (message);
464 #ifdef ENABLE_KDBUS_TRANSPORT
465 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
467 if(!kdbus_list_services (connection, &services, &len))
469 dbus_message_unref (reply);
477 if (!bus_registry_list_services (registry, &services, &len))
479 dbus_message_unref (reply);
485 dbus_message_iter_init_append (reply, &iter);
487 if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
488 DBUS_TYPE_STRING_AS_STRING,
491 dbus_free_string_array (services);
492 dbus_message_unref (reply);
497 #ifdef ENABLE_KDBUS_TRANSPORT
498 if(!bus_context_is_kdbus(bus_transaction_get_context (transaction))) //not needed for kdbus, we got it from kdbus_list_services
502 /* Include the bus driver in the list */
503 const char *v_STRING = DBUS_SERVICE_DBUS;
504 if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
507 dbus_free_string_array (services);
508 dbus_message_unref (reply);
517 if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
520 dbus_free_string_array (services);
521 dbus_message_unref (reply);
528 dbus_free_string_array (services);
530 if (!dbus_message_iter_close_container (&iter, &sub))
532 dbus_message_unref (reply);
537 if (!bus_transaction_send_from_driver (transaction, connection, reply))
539 dbus_message_unref (reply);
545 dbus_message_unref (reply);
551 bus_driver_handle_list_activatable_services (DBusConnection *connection,
552 BusTransaction *transaction,
553 DBusMessage *message,
559 BusActivation *activation;
561 DBusMessageIter iter;
564 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
566 activation = bus_connection_get_activation (connection);
568 reply = dbus_message_new_method_return (message);
575 if (!bus_activation_list_services (activation, &services, &len))
577 dbus_message_unref (reply);
582 dbus_message_iter_init_append (reply, &iter);
584 if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY,
585 DBUS_TYPE_STRING_AS_STRING,
588 dbus_free_string_array (services);
589 dbus_message_unref (reply);
595 /* Include the bus driver in the list */
596 const char *v_STRING = DBUS_SERVICE_DBUS;
597 if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
600 dbus_free_string_array (services);
601 dbus_message_unref (reply);
610 if (!dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING,
613 dbus_free_string_array (services);
614 dbus_message_unref (reply);
621 dbus_free_string_array (services);
623 if (!dbus_message_iter_close_container (&iter, &sub))
625 dbus_message_unref (reply);
630 if (!bus_transaction_send_from_driver (transaction, connection, reply))
632 dbus_message_unref (reply);
638 dbus_message_unref (reply);
644 bus_driver_handle_acquire_service (DBusConnection *connection,
645 BusTransaction *transaction,
646 DBusMessage *message,
650 DBusString service_name;
652 dbus_uint32_t service_reply;
655 BusRegistry *registry;
657 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
659 registry = bus_connection_get_registry (connection);
661 if (!dbus_message_get_args (message, error,
662 DBUS_TYPE_STRING, &name,
663 DBUS_TYPE_UINT32, &flags,
667 _dbus_verbose ("Trying to own name %s with flags 0x%x\n", name, flags);
672 #ifdef ENABLE_KDBUS_TRANSPORT
673 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
675 if (!bus_registry_acquire_kdbus_service (registry, connection,
677 &service_reply, transaction,
685 _dbus_string_init_const (&service_name, name);
687 if (!bus_registry_acquire_service (registry, connection,
688 &service_name, flags,
689 &service_reply, transaction,
694 reply = dbus_message_new_method_return (message);
701 if (!dbus_message_append_args (reply, DBUS_TYPE_UINT32, &service_reply, DBUS_TYPE_INVALID))
707 if (!bus_transaction_send_from_driver (transaction, connection, reply))
717 dbus_message_unref (reply);
722 bus_driver_handle_release_service (DBusConnection *connection,
723 BusTransaction *transaction,
724 DBusMessage *message,
728 DBusString service_name;
730 dbus_uint32_t service_reply;
732 BusRegistry *registry;
734 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
736 if (!dbus_message_get_args (message, error,
737 DBUS_TYPE_STRING, &name,
741 _dbus_verbose ("Trying to release name %s\n", name);
746 _dbus_string_init_const (&service_name, name);
747 registry = bus_connection_get_registry (connection);
749 #ifdef ENABLE_KDBUS_TRANSPORT
750 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
752 if (!bus_registry_release_service_kdbus (dbus_message_get_sender(message), connection,
753 &service_name, &service_reply,
759 if (!bus_registry_release_service (registry, connection,
760 &service_name, &service_reply,
764 reply = dbus_message_new_method_return (message);
771 if (!dbus_message_append_args (reply, DBUS_TYPE_UINT32, &service_reply, DBUS_TYPE_INVALID))
777 if (!bus_transaction_send_from_driver (transaction, connection, reply))
787 dbus_message_unref (reply);
792 bus_driver_handle_service_exists (DBusConnection *connection,
793 BusTransaction *transaction,
794 DBusMessage *message,
798 DBusString service_name;
800 dbus_bool_t service_exists;
803 BusRegistry *registry;
805 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
807 registry = bus_connection_get_registry (connection);
809 if (!dbus_message_get_args (message, error,
810 DBUS_TYPE_STRING, &name,
816 if (strcmp (name, DBUS_SERVICE_DBUS) == 0)
818 service_exists = TRUE;
822 #ifdef ENABLE_KDBUS_TRANSPORT
823 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
826 struct nameInfo info;
828 inter_ret = kdbus_NameQuery(name, dbus_connection_get_transport(connection), &info);
829 if((inter_ret == 0) || (inter_ret == -ENOENT))
830 service_exists = (inter_ret == 0) ? TRUE : FALSE;
833 _dbus_verbose("kdbus error checking if name exists: err %d (%m)\n", errno);
834 dbus_set_error (error, DBUS_ERROR_FAILED, "Could not determine whether name '%s' exists", name);
835 service_exists = FALSE;
841 _dbus_string_init_const (&service_name, name);
842 service = bus_registry_lookup (registry, &service_name);
843 service_exists = service != NULL;
847 reply = dbus_message_new_method_return (message);
854 if (!dbus_message_append_args (reply,
855 DBUS_TYPE_BOOLEAN, &service_exists,
862 if (!bus_transaction_send_from_driver (transaction, connection, reply))
872 dbus_message_unref (reply);
878 bus_driver_handle_activate_service (DBusConnection *connection,
879 BusTransaction *transaction,
880 DBusMessage *message,
886 BusActivation *activation;
888 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
890 activation = bus_connection_get_activation (connection);
892 if (!dbus_message_get_args (message, error,
893 DBUS_TYPE_STRING, &name,
894 DBUS_TYPE_UINT32, &flags,
897 _DBUS_ASSERT_ERROR_IS_SET (error);
898 _dbus_verbose ("No memory to get arguments to StartServiceByName\n");
904 if (!bus_activation_activate_service (activation, connection, transaction, FALSE,
905 message, name, error))
907 _DBUS_ASSERT_ERROR_IS_SET (error);
908 _dbus_verbose ("bus_activation_activate_service() failed\n");
919 send_ack_reply (DBusConnection *connection,
920 BusTransaction *transaction,
921 DBusMessage *message,
926 if (dbus_message_get_no_reply (message))
929 reply = dbus_message_new_method_return (message);
936 if (!bus_transaction_send_from_driver (transaction, connection, reply))
939 dbus_message_unref (reply);
943 dbus_message_unref (reply);
949 bus_driver_handle_update_activation_environment (DBusConnection *connection,
950 BusTransaction *transaction,
951 DBusMessage *message,
955 BusActivation *activation;
956 DBusMessageIter iter;
957 DBusMessageIter dict_iter;
958 DBusMessageIter dict_entry_iter;
961 DBusList *keys, *key_link;
962 DBusList *values, *value_link;
964 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
966 activation = bus_connection_get_activation (connection);
968 dbus_message_iter_init (message, &iter);
970 /* The message signature has already been checked for us,
971 * so let's just assert it's right.
973 _dbus_assert (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY);
975 dbus_message_iter_recurse (&iter, &dict_iter);
979 /* Then loop through the sent dictionary, add the location of
980 * the environment keys and values to lists. The result will
981 * be in reverse order, so we don't have to constantly search
982 * for the end of the list in a loop.
986 while ((array_type = dbus_message_iter_get_arg_type (&dict_iter)) == DBUS_TYPE_DICT_ENTRY)
988 dbus_message_iter_recurse (&dict_iter, &dict_entry_iter);
990 while ((key_type = dbus_message_iter_get_arg_type (&dict_entry_iter)) == DBUS_TYPE_STRING)
996 dbus_message_iter_get_basic (&dict_entry_iter, &key);
997 dbus_message_iter_next (&dict_entry_iter);
999 value_type = dbus_message_iter_get_arg_type (&dict_entry_iter);
1001 if (value_type != DBUS_TYPE_STRING)
1004 dbus_message_iter_get_basic (&dict_entry_iter, &value);
1006 if (!_dbus_list_append (&keys, key))
1008 BUS_SET_OOM (error);
1012 if (!_dbus_list_append (&values, value))
1014 BUS_SET_OOM (error);
1018 dbus_message_iter_next (&dict_entry_iter);
1021 if (key_type != DBUS_TYPE_INVALID)
1024 dbus_message_iter_next (&dict_iter);
1027 if (array_type != DBUS_TYPE_INVALID)
1030 _dbus_assert (_dbus_list_get_length (&keys) == _dbus_list_get_length (&values));
1033 value_link = values;
1034 while (key_link != NULL)
1039 key = key_link->data;
1040 value = value_link->data;
1042 if (!bus_activation_set_environment_variable (activation,
1045 _DBUS_ASSERT_ERROR_IS_SET (error);
1046 _dbus_verbose ("bus_activation_set_environment_variable() failed\n");
1049 key_link = _dbus_list_get_next_link (&keys, key_link);
1050 value_link = _dbus_list_get_next_link (&values, value_link);
1053 /* FIXME: We can fail early having set only some of the environment variables,
1054 * (because of OOM failure). It's sort of hard to fix and it doesn't really
1055 * matter, so we're punting for now.
1057 if (key_link != NULL)
1060 if (!send_ack_reply (connection, transaction,
1067 _dbus_list_clear (&keys);
1068 _dbus_list_clear (&values);
1073 bus_driver_handle_add_match (DBusConnection *connection,
1074 BusTransaction *transaction,
1075 DBusMessage *message,
1081 BusMatchmaker *matchmaker;
1083 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1088 if (bus_connection_get_n_match_rules (connection) >=
1089 bus_context_get_max_match_rules_per_connection (bus_transaction_get_context (transaction)))
1091 dbus_set_error (error, DBUS_ERROR_LIMITS_EXCEEDED,
1092 "Connection \"%s\" is not allowed to add more match rules "
1093 "(increase limits in configuration file if required)",
1094 bus_connection_is_active (connection) ?
1095 bus_connection_get_name (connection) :
1100 if (!dbus_message_get_args (message, error,
1101 DBUS_TYPE_STRING, &text,
1104 _dbus_verbose ("No memory to get arguments to AddMatch\n");
1108 _dbus_string_init_const (&str, text);
1110 rule = bus_match_rule_parse (connection, &str, error);
1114 #ifdef ENABLE_KDBUS_TRANSPORT
1115 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1118 if (!kdbus_add_match_rule (connection, message, text, error))
1121 if (!send_ack_reply (connection, transaction,
1129 matchmaker = bus_connection_get_matchmaker (connection);
1131 if (!bus_matchmaker_add_rule (matchmaker, rule))
1133 BUS_SET_OOM (error);
1137 if (!send_ack_reply (connection, transaction,
1140 bus_matchmaker_remove_rule (matchmaker, rule);
1145 bus_match_rule_unref (rule);
1150 _DBUS_ASSERT_ERROR_IS_SET (error);
1152 bus_match_rule_unref (rule);
1157 bus_driver_handle_remove_match (DBusConnection *connection,
1158 BusTransaction *transaction,
1159 DBusMessage *message,
1165 BusMatchmaker *matchmaker;
1167 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1172 if (!dbus_message_get_args (message, error,
1173 DBUS_TYPE_STRING, &text,
1176 _dbus_verbose ("No memory to get arguments to RemoveMatch\n");
1180 _dbus_string_init_const (&str, text);
1182 rule = bus_match_rule_parse (connection, &str, error);
1186 #ifdef ENABLE_KDBUS_TRANSPORT
1187 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1189 if(!kdbus_remove_match(connection, message, error))
1194 /* Send the ack before we remove the rule, since the ack is undone
1195 * on transaction cancel, but rule removal isn't.
1197 if (!send_ack_reply (connection, transaction,
1201 #ifdef ENABLE_KDBUS_TRANSPORT
1202 if(!bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1205 matchmaker = bus_connection_get_matchmaker (connection);
1207 if (!bus_matchmaker_remove_rule_by_value (matchmaker, rule, error))
1211 bus_match_rule_unref (rule);
1216 _DBUS_ASSERT_ERROR_IS_SET (error);
1218 bus_match_rule_unref (rule);
1223 bus_driver_handle_get_service_owner (DBusConnection *connection,
1224 BusTransaction *transaction,
1225 DBusMessage *message,
1229 const char *base_name;
1231 BusRegistry *registry;
1232 BusService *service;
1234 #ifdef ENABLE_KDBUS_TRANSPORT
1235 char unique_name[(unsigned int)(snprintf((char*)base_name, 0, "%llu", ULLONG_MAX) + sizeof(":1."))];
1238 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1240 registry = bus_connection_get_registry (connection);
1245 if (! dbus_message_get_args (message, error,
1246 DBUS_TYPE_STRING, &text,
1250 #ifdef ENABLE_KDBUS_TRANSPORT
1251 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1255 ret = kdbus_get_name_owner(connection, text, unique_name);
1257 base_name = unique_name;
1258 else if(ret == -ENOENT) //name has no owner
1260 dbus_set_error (error, DBUS_ERROR_NAME_HAS_NO_OWNER,
1261 "Could not get owner of name '%s': no such name", text);
1266 dbus_set_error (error, DBUS_ERROR_FAILED,
1267 "Could not determine unique name for '%s'", text);
1274 _dbus_string_init_const (&str, text);
1275 service = bus_registry_lookup (registry, &str);
1276 if (service == NULL &&
1277 _dbus_string_equal_c_str (&str, DBUS_SERVICE_DBUS))
1279 /* ORG_FREEDESKTOP_DBUS owns itself */
1280 base_name = DBUS_SERVICE_DBUS;
1282 else if (service == NULL)
1284 dbus_set_error (error,
1285 DBUS_ERROR_NAME_HAS_NO_OWNER,
1286 "Could not get owner of name '%s': no such name", text);
1291 base_name = bus_connection_get_name (bus_service_get_primary_owners_connection (service));
1292 if (base_name == NULL)
1294 /* FIXME - how is this error possible? */
1295 dbus_set_error (error,
1297 "Could not determine unique name for '%s'", text);
1300 _dbus_assert (*base_name == ':');
1303 _dbus_assert (base_name != NULL);
1305 reply = dbus_message_new_method_return (message);
1309 if (! dbus_message_append_args (reply,
1310 DBUS_TYPE_STRING, &base_name,
1314 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1317 dbus_message_unref (reply);
1322 BUS_SET_OOM (error);
1325 _DBUS_ASSERT_ERROR_IS_SET (error);
1327 dbus_message_unref (reply);
1332 bus_driver_handle_list_queued_owners (DBusConnection *connection,
1333 BusTransaction *transaction,
1334 DBusMessage *message,
1338 DBusList *base_names;
1341 BusRegistry *registry;
1342 BusService *service;
1344 DBusMessageIter iter, array_iter;
1345 char *dbus_service_name = DBUS_SERVICE_DBUS;
1347 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1349 registry = bus_connection_get_registry (connection);
1355 if (! dbus_message_get_args (message, error,
1356 DBUS_TYPE_STRING, &text,
1360 _dbus_string_init_const (&str, text);
1361 service = bus_registry_lookup (registry, &str);
1362 if (service == NULL &&
1363 _dbus_string_equal_c_str (&str, DBUS_SERVICE_DBUS))
1365 /* ORG_FREEDESKTOP_DBUS owns itself */
1366 if (! _dbus_list_append (&base_names, dbus_service_name))
1369 #ifdef ENABLE_KDBUS_TRANSPORT
1370 else if (!bus_context_is_kdbus(bus_transaction_get_context (transaction)) && (service == NULL))
1372 else if (service == NULL)
1375 dbus_set_error (error,
1376 DBUS_ERROR_NAME_HAS_NO_OWNER,
1377 "Could not get owners of name '%s': no such name", text);
1382 #ifdef ENABLE_KDBUS_TRANSPORT
1383 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1385 if(!kdbus_list_queued (connection, &base_names, text ,error))
1391 if (!bus_service_list_queued_owners (service,
1398 _dbus_assert (base_names != NULL);
1400 reply = dbus_message_new_method_return (message);
1404 dbus_message_iter_init_append (reply, &iter);
1405 if (!dbus_message_iter_open_container (&iter,
1407 DBUS_TYPE_STRING_AS_STRING,
1411 link = _dbus_list_get_first_link (&base_names);
1412 while (link != NULL)
1416 _dbus_assert (link->data != NULL);
1417 uname = (char *)link->data;
1419 if (!dbus_message_iter_append_basic (&array_iter,
1424 link = _dbus_list_get_next_link (&base_names, link);
1427 if (! dbus_message_iter_close_container (&iter, &array_iter))
1431 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1434 dbus_message_unref (reply);
1436 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1438 link = _dbus_list_get_first_link (&base_names);
1439 while (link != NULL)
1441 DBusList *next = _dbus_list_get_next_link (&base_names, link);
1443 if(link->data != NULL)
1446 _dbus_list_free_link (link);
1454 BUS_SET_OOM (error);
1457 _DBUS_ASSERT_ERROR_IS_SET (error);
1459 dbus_message_unref (reply);
1461 _dbus_list_clear (&base_names);
1466 bus_driver_handle_get_connection_unix_user (DBusConnection *connection,
1467 BusTransaction *transaction,
1468 DBusMessage *message,
1471 DBusConnection *conn;
1474 dbus_uint32_t uid32;
1475 const char *service;
1477 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1479 reply = dbus_message_new_method_return (message);
1483 #ifdef ENABLE_KDBUS_TRANSPORT
1484 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1488 if(!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
1490 if(!kdbus_get_unix_user(connection, name, &uid, error))
1496 conn = bus_driver_get_conn_helper (connection, message, "UID", &service,
1502 if (!dbus_connection_get_unix_user (conn, &uid))
1504 dbus_set_error (error,
1506 "Could not determine UID for '%s'", service);
1512 if (! dbus_message_append_args (reply,
1513 DBUS_TYPE_UINT32, &uid32,
1517 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1520 dbus_message_unref (reply);
1525 BUS_SET_OOM (error);
1528 _DBUS_ASSERT_ERROR_IS_SET (error);
1530 dbus_message_unref (reply);
1535 bus_driver_handle_get_connection_unix_process_id (DBusConnection *connection,
1536 BusTransaction *transaction,
1537 DBusMessage *message,
1540 DBusConnection *conn;
1543 dbus_uint32_t pid32;
1544 const char *service;
1546 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1548 reply = dbus_message_new_method_return (message);
1551 #ifdef ENABLE_KDBUS_TRANSPORT
1552 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1556 if(!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
1558 if(!kdbus_get_connection_unix_process_id(connection, name, &pid, error))
1564 conn = bus_driver_get_conn_helper (connection, message, "PID", &service,
1569 if (!dbus_connection_get_unix_process_id (conn, &pid))
1571 dbus_set_error (error,
1572 DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN,
1573 "Could not determine PID for '%s'", service);
1579 if (! dbus_message_append_args (reply,
1580 DBUS_TYPE_UINT32, &pid32,
1584 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1587 dbus_message_unref (reply);
1592 BUS_SET_OOM (error);
1595 _DBUS_ASSERT_ERROR_IS_SET (error);
1597 dbus_message_unref (reply);
1602 bus_driver_handle_get_adt_audit_session_data (DBusConnection *connection,
1603 BusTransaction *transaction,
1604 DBusMessage *message,
1607 DBusConnection *conn;
1610 dbus_uint32_t data_size;
1611 const char *service;
1613 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1617 conn = bus_driver_get_conn_helper (connection, message,
1618 "audit session data", &service, error);
1623 reply = dbus_message_new_method_return (message);
1627 if (!dbus_connection_get_adt_audit_session_data (conn, &data, &data_size) || data == NULL)
1629 dbus_set_error (error,
1630 DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN,
1631 "Could not determine audit session data for '%s'", service);
1635 if (! dbus_message_append_args (reply,
1636 DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &data, data_size,
1640 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1643 dbus_message_unref (reply);
1648 BUS_SET_OOM (error);
1651 _DBUS_ASSERT_ERROR_IS_SET (error);
1653 dbus_message_unref (reply);
1658 bus_driver_handle_get_connection_selinux_security_context (DBusConnection *connection,
1659 BusTransaction *transaction,
1660 DBusMessage *message,
1663 DBusConnection *conn;
1665 BusSELinuxID *context;
1666 const char *service;
1668 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1670 reply = dbus_message_new_method_return (message);
1674 #ifdef ENABLE_KDBUS_TRANSPORT
1675 if(bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1677 if(!kdbus_get_connection_unix_selinux_security_context(connection, message, reply, error))
1683 conn = bus_driver_get_conn_helper (connection, message, "security context",
1689 context = bus_connection_get_selinux_id (conn);
1692 dbus_set_error (error,
1693 DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN,
1694 "Could not determine security context for '%s'", service);
1698 if (! bus_selinux_append_context (reply, context, error))
1702 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1705 dbus_message_unref (reply);
1710 BUS_SET_OOM (error);
1713 _DBUS_ASSERT_ERROR_IS_SET (error);
1715 dbus_message_unref (reply);
1720 bus_driver_handle_get_connection_credentials (DBusConnection *connection,
1721 BusTransaction *transaction,
1722 DBusMessage *message,
1725 DBusConnection *conn;
1727 DBusMessageIter reply_iter;
1728 DBusMessageIter array_iter;
1729 unsigned long ulong_val;
1730 const char *service;
1732 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1734 reply = _dbus_asv_new_method_return (message, &reply_iter, &array_iter);
1738 #ifdef ENABLE_KDBUS_TRANSPORT
1739 if(!bus_context_is_kdbus(bus_transaction_get_context (transaction)))
1742 conn = bus_driver_get_conn_helper (connection, message, "credentials",
1748 /* we can't represent > 32-bit pids; if your system needs them, please
1749 * add ProcessID64 to the spec or something */
1750 if (dbus_connection_get_unix_process_id (conn, &ulong_val) &&
1751 ulong_val <= _DBUS_UINT32_MAX)
1753 if (!_dbus_asv_add_uint32 (&array_iter, "ProcessID", ulong_val))
1757 /* we can't represent > 32-bit uids; if your system needs them, please
1758 * add UnixUserID64 to the spec or something */
1759 if (dbus_connection_get_unix_user (conn, &ulong_val) &&
1760 ulong_val <= _DBUS_UINT32_MAX)
1762 if (!_dbus_asv_add_uint32 (&array_iter, "UnixUserID", ulong_val))
1765 #ifdef ENABLE_KDBUS_TRANSPORT
1771 if(!dbus_message_get_args(message, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID))
1773 if(kdbus_get_connection_unix_process_id(connection, name, &ulong_val, error))
1775 if (!_dbus_asv_add_uint32 (&array_iter, "ProcessID", ulong_val))
1781 if(kdbus_get_unix_user(connection, name, &ulong_val, error))
1783 if (!_dbus_asv_add_uint32 (&array_iter, "UnixUserID", ulong_val))
1791 if (!_dbus_asv_close (&reply_iter, &array_iter))
1794 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1796 /* this time we don't want to close the iterator again, so just
1797 * get rid of the message */
1798 dbus_message_unref (reply);
1806 BUS_SET_OOM (error);
1809 _DBUS_ASSERT_ERROR_IS_SET (error);
1813 _dbus_asv_abandon (&reply_iter, &array_iter);
1814 dbus_message_unref (reply);
1821 bus_driver_handle_reload_config (DBusConnection *connection,
1822 BusTransaction *transaction,
1823 DBusMessage *message,
1826 BusContext *context;
1829 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1833 context = bus_connection_get_context (connection);
1834 if (!bus_context_reload_config (context, error))
1837 reply = dbus_message_new_method_return (message);
1841 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1844 dbus_message_unref (reply);
1848 BUS_SET_OOM (error);
1851 _DBUS_ASSERT_ERROR_IS_SET (error);
1853 dbus_message_unref (reply);
1858 bus_driver_handle_get_id (DBusConnection *connection,
1859 BusTransaction *transaction,
1860 DBusMessage *message,
1863 BusContext *context;
1866 const char *v_STRING;
1868 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1870 if (!_dbus_string_init (&uuid))
1872 BUS_SET_OOM (error);
1878 context = bus_connection_get_context (connection);
1879 if (!bus_context_get_id (context, &uuid))
1882 reply = dbus_message_new_method_return (message);
1886 v_STRING = _dbus_string_get_const_data (&uuid);
1887 if (!dbus_message_append_args (reply,
1888 DBUS_TYPE_STRING, &v_STRING,
1892 _dbus_assert (dbus_message_has_signature (reply, "s"));
1894 if (! bus_transaction_send_from_driver (transaction, connection, reply))
1897 _dbus_string_free (&uuid);
1898 dbus_message_unref (reply);
1902 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1904 BUS_SET_OOM (error);
1907 dbus_message_unref (reply);
1908 _dbus_string_free (&uuid);
1915 const char *in_args;
1916 const char *out_args;
1917 dbus_bool_t (* handler) (DBusConnection *connection,
1918 BusTransaction *transaction,
1919 DBusMessage *message,
1923 /* For speed it might be useful to sort this in order of
1924 * frequency of use (but doesn't matter with only a few items
1927 static const MessageHandler dbus_message_handlers[] = {
1930 DBUS_TYPE_STRING_AS_STRING,
1931 bus_driver_handle_hello },
1933 DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING,
1934 DBUS_TYPE_UINT32_AS_STRING,
1935 bus_driver_handle_acquire_service },
1937 DBUS_TYPE_STRING_AS_STRING,
1938 DBUS_TYPE_UINT32_AS_STRING,
1939 bus_driver_handle_release_service },
1940 { "StartServiceByName",
1941 DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_UINT32_AS_STRING,
1942 DBUS_TYPE_UINT32_AS_STRING,
1943 bus_driver_handle_activate_service },
1944 { "UpdateActivationEnvironment",
1945 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,
1947 bus_driver_handle_update_activation_environment },
1949 DBUS_TYPE_STRING_AS_STRING,
1950 DBUS_TYPE_BOOLEAN_AS_STRING,
1951 bus_driver_handle_service_exists },
1954 DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
1955 bus_driver_handle_list_services },
1956 { "ListActivatableNames",
1958 DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
1959 bus_driver_handle_list_activatable_services },
1961 DBUS_TYPE_STRING_AS_STRING,
1963 bus_driver_handle_add_match },
1965 DBUS_TYPE_STRING_AS_STRING,
1967 bus_driver_handle_remove_match },
1969 DBUS_TYPE_STRING_AS_STRING,
1970 DBUS_TYPE_STRING_AS_STRING,
1971 bus_driver_handle_get_service_owner },
1972 { "ListQueuedOwners",
1973 DBUS_TYPE_STRING_AS_STRING,
1974 DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_STRING_AS_STRING,
1975 bus_driver_handle_list_queued_owners },
1976 { "GetConnectionUnixUser",
1977 DBUS_TYPE_STRING_AS_STRING,
1978 DBUS_TYPE_UINT32_AS_STRING,
1979 bus_driver_handle_get_connection_unix_user },
1980 { "GetConnectionUnixProcessID",
1981 DBUS_TYPE_STRING_AS_STRING,
1982 DBUS_TYPE_UINT32_AS_STRING,
1983 bus_driver_handle_get_connection_unix_process_id },
1984 { "GetAdtAuditSessionData",
1985 DBUS_TYPE_STRING_AS_STRING,
1986 DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING,
1987 bus_driver_handle_get_adt_audit_session_data },
1988 { "GetConnectionSELinuxSecurityContext",
1989 DBUS_TYPE_STRING_AS_STRING,
1990 DBUS_TYPE_ARRAY_AS_STRING DBUS_TYPE_BYTE_AS_STRING,
1991 bus_driver_handle_get_connection_selinux_security_context },
1995 bus_driver_handle_reload_config },
1998 DBUS_TYPE_STRING_AS_STRING,
1999 bus_driver_handle_get_id },
2000 { "GetConnectionCredentials", "s", "a{sv}",
2001 bus_driver_handle_get_connection_credentials },
2002 { NULL, NULL, NULL, NULL }
2005 static dbus_bool_t bus_driver_handle_introspect (DBusConnection *,
2006 BusTransaction *, DBusMessage *, DBusError *);
2008 static const MessageHandler introspectable_message_handlers[] = {
2009 { "Introspect", "", DBUS_TYPE_STRING_AS_STRING, bus_driver_handle_introspect },
2010 { NULL, NULL, NULL, NULL }
2013 #ifdef DBUS_ENABLE_STATS
2014 static const MessageHandler stats_message_handlers[] = {
2015 { "GetStats", "", "a{sv}", bus_stats_handle_get_stats },
2016 { "GetConnectionStats", "s", "a{sv}", bus_stats_handle_get_connection_stats },
2017 { NULL, NULL, NULL, NULL }
2023 const MessageHandler *message_handlers;
2024 const char *extra_introspection;
2027 /* These should ideally be sorted by frequency of use, although it
2028 * probably doesn't matter with this few items */
2029 static InterfaceHandler interface_handlers[] = {
2030 { DBUS_INTERFACE_DBUS, dbus_message_handlers,
2031 " <signal name=\"NameOwnerChanged\">\n"
2032 " <arg type=\"s\"/>\n"
2033 " <arg type=\"s\"/>\n"
2034 " <arg type=\"s\"/>\n"
2036 " <signal name=\"NameLost\">\n"
2037 " <arg type=\"s\"/>\n"
2039 " <signal name=\"NameAcquired\">\n"
2040 " <arg type=\"s\"/>\n"
2042 { DBUS_INTERFACE_INTROSPECTABLE, introspectable_message_handlers, NULL },
2043 #ifdef DBUS_ENABLE_STATS
2044 { BUS_INTERFACE_STATS, stats_message_handlers, NULL },
2046 { NULL, NULL, NULL }
2050 write_args_for_direction (DBusString *xml,
2051 const char *signature,
2054 DBusTypeReader typereader;
2058 _dbus_string_init_const (&sigstr, signature);
2059 _dbus_type_reader_init_types_only (&typereader, &sigstr, 0);
2061 while ((current_type = _dbus_type_reader_get_current_type (&typereader)) != DBUS_TYPE_INVALID)
2063 const DBusString *subsig;
2066 _dbus_type_reader_get_signature (&typereader, &subsig, &start, &len);
2067 if (!_dbus_string_append_printf (xml, " <arg direction=\"%s\" type=\"",
2070 if (!_dbus_string_append_len (xml,
2071 _dbus_string_get_const_data (subsig) + start,
2074 if (!_dbus_string_append (xml, "\"/>\n"))
2077 _dbus_type_reader_next (&typereader);
2085 bus_driver_generate_introspect_string (DBusString *xml)
2087 const InterfaceHandler *ih;
2088 const MessageHandler *mh;
2090 if (!_dbus_string_append (xml, DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE))
2092 if (!_dbus_string_append (xml, "<node>\n"))
2095 for (ih = interface_handlers; ih->name != NULL; ih++)
2097 if (!_dbus_string_append_printf (xml, " <interface name=\"%s\">\n",
2101 for (mh = ih->message_handlers; mh->name != NULL; mh++)
2103 if (!_dbus_string_append_printf (xml, " <method name=\"%s\">\n",
2107 if (!write_args_for_direction (xml, mh->in_args, TRUE))
2110 if (!write_args_for_direction (xml, mh->out_args, FALSE))
2113 if (!_dbus_string_append (xml, " </method>\n"))
2117 if (ih->extra_introspection != NULL &&
2118 !_dbus_string_append (xml, ih->extra_introspection))
2121 if (!_dbus_string_append (xml, " </interface>\n"))
2125 if (!_dbus_string_append (xml, "</node>\n"))
2132 bus_driver_handle_introspect (DBusConnection *connection,
2133 BusTransaction *transaction,
2134 DBusMessage *message,
2139 const char *v_STRING;
2141 _dbus_verbose ("Introspect() on bus driver\n");
2143 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
2147 if (! dbus_message_get_args (message, error,
2150 _DBUS_ASSERT_ERROR_IS_SET (error);
2154 if (!_dbus_string_init (&xml))
2156 BUS_SET_OOM (error);
2160 if (!bus_driver_generate_introspect_string (&xml))
2163 v_STRING = _dbus_string_get_const_data (&xml);
2165 reply = dbus_message_new_method_return (message);
2169 if (! dbus_message_append_args (reply,
2170 DBUS_TYPE_STRING, &v_STRING,
2174 if (! bus_transaction_send_from_driver (transaction, connection, reply))
2177 dbus_message_unref (reply);
2178 _dbus_string_free (&xml);
2183 BUS_SET_OOM (error);
2186 dbus_message_unref (reply);
2188 _dbus_string_free (&xml);
2194 bus_driver_handle_message (DBusConnection *connection,
2195 BusTransaction *transaction,
2196 DBusMessage *message,
2199 const char *name, *interface;
2200 const InterfaceHandler *ih;
2201 const MessageHandler *mh;
2202 dbus_bool_t found_interface = FALSE;
2204 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
2206 if (dbus_message_is_signal (message, "org.freedesktop.systemd1.Activator", "ActivationFailure"))
2208 BusContext *context;
2210 context = bus_connection_get_context (connection);
2211 return dbus_activation_systemd_failure(bus_context_get_activation(context), message);
2214 if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
2216 _dbus_verbose ("Driver got a non-method-call message, ignoring\n");
2217 return TRUE; /* we just ignore this */
2220 /* may be NULL, which means "any interface will do" */
2221 interface = dbus_message_get_interface (message);
2223 _dbus_assert (dbus_message_get_member (message) != NULL);
2225 name = dbus_message_get_member (message);
2227 _dbus_verbose ("Driver got a method call: %s\n", name);
2229 /* security checks should have kept this from getting here */
2230 _dbus_assert (dbus_message_get_sender (message) != NULL ||
2231 strcmp (name, "Hello") == 0);
2233 for (ih = interface_handlers; ih->name != NULL; ih++)
2235 if (interface != NULL && strcmp (interface, ih->name) != 0)
2238 found_interface = TRUE;
2240 for (mh = ih->message_handlers; mh->name != NULL; mh++)
2242 if (strcmp (mh->name, name) != 0)
2245 _dbus_verbose ("Found driver handler for %s\n", name);
2247 if (!dbus_message_has_signature (message, mh->in_args))
2249 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
2250 _dbus_verbose ("Call to %s has wrong args (%s, expected %s)\n",
2251 name, dbus_message_get_signature (message),
2254 dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
2255 "Call to %s has wrong args (%s, expected %s)\n",
2256 name, dbus_message_get_signature (message),
2258 _DBUS_ASSERT_ERROR_IS_SET (error);
2262 if ((* mh->handler) (connection, transaction, message, error))
2264 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
2265 _dbus_verbose ("Driver handler succeeded\n");
2270 _DBUS_ASSERT_ERROR_IS_SET (error);
2271 _dbus_verbose ("Driver handler returned failure\n");
2277 _dbus_verbose ("No driver handler for message \"%s\"\n",
2280 dbus_set_error (error, found_interface ? DBUS_ERROR_UNKNOWN_METHOD : DBUS_ERROR_UNKNOWN_INTERFACE,
2281 "%s does not understand message %s",
2282 DBUS_SERVICE_DBUS, name);
2288 bus_driver_remove_connection (DBusConnection *connection)
2290 /* FIXME 1.0 Does nothing for now, should unregister the connection
2291 * with the bus driver.