- if((*result == DBUS_REQUEST_NAME_REPLY_IN_QUEUE) || (*result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER))
- {
- DBusConnection* phantom;
- const char* name;
-// DBusList *link;
-
- name = dbus_message_get_sender(message);
- phantom = bus_connections_find_conn_by_name(bus_connection_get_connections(connection), name);
- if(phantom == NULL)
- phantom = create_phantom_connection(connection, name, error);
- if(phantom == NULL)
- goto failed2;
- if (!bus_service_add_owner (service, phantom, flags, transaction, error))
- goto failed2;
- if((*result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) && rm_owner_daemon)
- {
- /* Here we are removing DBus daemon as an owner of the service,
- * which is set by bus_registry_ensure.
- * If bus_service_remove_owner fail, we ignore it, because it has
- * almost none impact on the usage
- */
- if(_bus_service_find_owner_link (service, connection))
- bus_service_remove_owner (service, connection, transaction, NULL);
- }
- /*if(bus_service_get_is_kdbus_starter(service))
- {
- if (!bus_service_swap_owner (service, bus_service_get_primary_owners_connection(service),
- transaction, error))
- goto failed2;
- }*/
- /*if((link = _bus_service_find_owner_link (service, connection))) //if daemon is a starter
- {
- _dbus_list_unlink (&service->owners, link);
- _dbus_list_append_link (&service->owners, link); //it must be moved at the end of the queue
- }*/
- }
+#ifdef POLICY_TO_KDBUS
+ if (!register_kdbus_policy(name, dbus_connection_get_transport(phantom), uid))
+ {
+ dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED,
+ "Kdbus error when setting policy for connection \"%s\" and service name \"%s\"",
+ conn_unique_name, name);
+ goto failed;
+ }
+#endif