summaryrefslogtreecommitdiffstats
path: root/bus/dispatch.c
Commit message (Collapse)AuthorAgeFilesLines
* * configure.in: Add test/name-test/Makefile to the generatedJohn (J5) Palmieri2005-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefile list * dbus/dbus-shared.h (#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT): New flag which replaces DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT (#define DBUS_NAME_FLAG_DO_NOT_QUEUE): New flag for specifying not to queue an ower if it can't be the primary owner * bus/bus.h: Add new internal BusOwner struct * bus/driver.c (bus_driver_handle_hello): Send flags (0 for default) to bus_registry_ensure and don't set the prohibit_replacement flag since they are now set per BusOwner and not per name. (bus_driver_handle_list_queued_owners): bus method (ListQueuedOwners) that returns the list of connections in a name's connection queue * bus/services.c (struct BusService): remove prohibit_replacement field (struct BusOwner): new struct for keeping track of queued connections and their associated flags for the queue (struct BusRegistry): add a BusOwner memory pool (bus_registry_new): initialize the BusOwner memory pool (bus_registry_unref): free the BusOwner memory pool (_bus_service_find_owner_link): new internal method for searching the queue for a specific connection (bus_owner_set_flags): new method for adding setting the flags on a bus owner (bus_owner_new): new method that creates a BusOwner object from the pool and sets its flags (bus_owner_ref, bus_owner_unref): ref counting for BusOwner objects (bus_registry_ensure): Add the flags parameter (bus_registry_acquire_service): Switch from using raw connections to using the BusOwner struct Add new state machine for dealing with the new set of flags (bus_registry_set_service_context_table, struct OwnershipCancelData, cancel_ownership, free_ownership_cancel_data, add_cancel_ownership_to_transaction, struct OwnershipRestoreData, restore_ownership, free_ownership_restore_data, add_restore_ownership_to_transaction): Switch to using BusOwner instead of raw connections (bus_service_add_owner): Add flags parameter Switch to using BusOwner instead of raw connections Add state machine for dealing with the new set of flags (bus_service_swap_owner): Swaps the first and second owners in the queue. Used to make sure proper signals are sent when a service looses or gains primary ownership. We never insert an owner at the top of the queue. Instead we insert it in the second position and then swap. (bus_service_remove_owner): Remove the owner from the queue sending out the NameLost and NameOwnerChanged signals if the we were the primary owner (bus_service_get_primary_owners_connection): New method that extracts the connection from the primary owner (bus_service_get_primary_owner): Returns the BusOwner instead of the connection (bus_service_get_allow_replacement): Changed from the old bus_service_get_prohibit_replacement method. Checks the flags of the primary owner and returns if it can be replaced or not (bus_service_set_prohibit_replacement): removed (bus_service_has_owner): returns TRUE if and owner with the specified connection exists in the queue * dbus/dbus-bus.c (dbus_bus_connection_get_unique_name): New helper method that only compiles if tests are enabled. Allows us to get the unique name of a connection so we can check it against the queue when doing regression tests * bus/activation.c (bus_activation_send_pending_auto_activate), bus/dispatch.c (bus_dispatch), bus/driver.c (bus_driver_handle_get_service_owner, bus_driver_handle_get_connection_unix_user, bus_driver_handle_get_connection_unix_process_id, bus_driver_handle_get_connection_selinux_security_context), bus/signals.c (connection_is_primary_owner): use bus_service_get_primary_owners_connection instead of bus_service_get_primary_owner * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket, _dbus_listen_unix_socket): Calculate the length of the socket path and use that instead of using a fixed length which was causing socket names to contain many trailing Nul bytes. * dbus/dbus-glib-lowlevel.h, glib/dbus-gobject.c (dbus_g_method_get_sender): New method for extracting the sender from a DBusGMethodInvocation (dbus_g_method_return_get_reply): changed name to dbus_g_method_get_reply (dbus_g_method_return_send_reply): changed name to dbus_g_method_send reply * doc/dbus-specification.xml: New docs that describe how the new queueing system works and talks about the changes to the how we specify socket names * glib/examples/example-service.c, glib/examples/example-signal-emitter.c, glib/examples/statemachine/statemachine-server.c: Changed the RequestName flags to the new system * test/name-test/ (test-names.c, run-test.sh, Makefile.am): New regression test suite for testing various states of the new queueing system
* * bus/driver.c (bus_driver_handle_introspect): Add signalsJohn (J5) Palmieri2005-10-031-0/+62
| | | | | | | | | | | | | | | to the introspect data. (patch from Daniel P. Berrange <dan at berrange.com>) * bus/dispatch.c (check_existent_ping): Add testcase for Ping * dbus/dbus-connection.c (_dbus_connection_peer_filter, _dbus_connection_run_builtin_filters): Changed these to be unlock_no_update functions and call _dbus_connection_send_unlocked_no_update instead of dbus_connection_send to avoid locking errors. * doc/TODO: Removed the make Ping test TODO
* 2005-09-11 Mark McLoughlin <mark@skynet.ie>Mark McLoughlin2005-09-111-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/data/auth/fallback.auth-script: we don't retry the EXTERNAL method when we know its going to fail anymore. 2005-09-11 Mark McLoughlin <mark@skynet.ie> * dbus/dbus-connection-internal.h: rename (add|remove|toggle)_(watch|timeout) to unlocked() * dbus/dbus-connection.c: ditto. * dbus/dbus-timeout.c, dbus/dbus-transport-unix.c: Update some callers for the renaming. 2005-09-10 Mark McLoughlin <mark@skynet.ie> * dbus/dbus-auth.c: (record_mechanisms): don't retry the first auth mechanism because we know we're just going to get rejected again. * dbus/dbus-keyring.c: (_dbus_keyring_reload): Fix thinko ... and what a nasty little bugger to track down you were ... * dbus/dbus-connection.c: (_dbus_connection_add_watch), (_dbus_connection_remove_watch): add note about these needing the connection to be locked. (_dbus_connection_get_dispatch_status_unlocked): set status to DATA_REMAINS when we queue the disconnected message. * bus/dispatch.c: (bus_dispatch): fix warning. (check_existent_service_no_auto_start): Expect ChildSignaled error too. (check_existent_hello_from_self): fix another couple of warnings.
* * bus/dispatch.c, test/test-service.c: Add testcaseJohn (J5) Palmieri2005-07-151-1/+77
| | | | | | | | | | | | for sending messages to oneself (TODO item). * python/service.py (class Object): Swap ordering of bus_name and object_path parameters to better support inheritance. * doc/dbus-tutorial.xml: change Python docs to reflect change in parameter ordering and fix the inheritance section. * doc/TODO: remove sending message to oneself TODO item
* Checking in Rodrigo's patch along with my fixes to the patchJohn (J5) Palmieri2005-07-141-148/+493
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-07-14 John (J5) Palmieri <johnp@redhat.com> * bus/activation.c: clean up all tabs to be 8 spaces (bus_activation_activate_service): make sure we clean up if activation fails * bus/dispatch.c: clean up all tabs to be 8 spaces (check_shell_fail_service_auto_start): New function tests to make sure we get fail properly when trying to auto start a service with a faulty command line (check_shell_service_success_auto_start): New function tests to make sure auto started services get the arguments on the command line * test/test-shell-service.c: Added service for testing auto-starting with command line arguments * test/data/valid-service-files/debug-shell-echo-fail.service.in, test/data/valid-service-files/debug-shell-echo-success.service.in: Added service files for testing auto-starting with command line arguments * */.cvsignore: added a bunch of generated files to various .cvsignore files 2005-07-14 Rodrigo Moya <rodrigo@novell.com> * dbus/dbus-shell.[ch]: copy/pasted code from GLib. * dbus/Makefile.am: added new files to build. * bus/activation.c (bus_activation_activate_service): support activation commands with parameters. * test/shell-test.c: added test program for the shell parsing code.
* * dbus/dbus-connection.c, dbus/dbus-connection.hJohn (J5) Palmieri2005-06-021-4/+4
| | | | | | | | | | | | | | | | | | | | | (dbus_connection_disconnect): renamed to dbus_connection_close for API symmetry with dbus_connection_open (_dbus_connection_open_internal): s/dbus_connection_disconnect/dbus_connection_close * dbus/dbus-bus.c (dbus_bus_get): s/dbus_connection_disconnect/dbus_connection_close * bus/connection.c (bus_connections_unref, bus_connections_setup_connection, bus_connections_expire_incomplete): s/dbus_connection_disconnect/dbus_connection_close * bus/dispatch.c (bus_dispatch, kill_client_connection, kill_client_connection_unchecked, check_hello_connection): s/dbus_connection_disconnect/dbus_connection_close * bus/bus.c (new_connection_callback): s/dbus_connection_disconnect/dbus_connection_close
* 2005-02-17 Colin Walters <walters@verbum.org>Colin Walters2005-02-171-41/+41
| | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS): Rename to DBUS_SERVICE_DBUS. (DBUS_PATH_ORG_FREEDESKTOP_DBUS): Rename to DBUS_PATH_DBUS. (DBUS_PATH_ORG_FREEDESKTOP_LOCAL): Rename to DBUS_PATH_LOCAL. (DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS): Rename to DBUS_INTERFACE_DBUS. (DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE): Rename to DBUS_INTERFACE_INTROSPECTABLE. (DBUS_INTERFACE_ORG_FREEDESKTOP_PROPERTIES): Rename to DBUS_INTERFACE_PROPERTIES. (DBUS_INTERFACE_ORG_FREEDESKTOP_PEER): Rename to DBUS_INTERFACE_PEER. (DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL): DBUS_INTERFACE_LOCAL. All other users of those constants have been changed. * bus/driver.c (bus_driver_handle_introspect): Use constants. * glib/dbus-gobject.c (handle_introspect): Use constants. * doc/dbus-faq.xml, doc/dbus-specification.xml: Update for rename.
* 2005-01-20 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-01-211-33/+33
| | | | | | | | | | | | | | * doc/dbus-tutorial.xml: replace > with &gt; * bus/services.c (bus_registry_acquire_service): validate the name and return a better error if it's no good. * doc/dbus-specification.xml: note NO_AUTO_START change * dbus/dbus-protocol.h (DBUS_HEADER_FLAG_NO_AUTO_START): change from AUTO_START, we're toggling the default * bus/dispatch.c: adapt the tests to change of auto-start default
* 2005-01-18 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-01-181-53/+53
| | | | | | | | | | | | * Throughout, grand renaming to strip out the use of "service", just say "name" instead (or "bus name" when ambiguous). Did not change the internal code of the message bus itself, only the programmer-facing API and messages. * doc/dbus-specification.xml: further update the message bus section * bus/config-parser.c (all_are_equiv): fix bug using freed string in error case
* 2005-01-15 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-01-151-82/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Land the new message args API and type system. This patch is huge, but the public API change is not really large. The set of D-BUS types has changed somewhat, and the arg "getters" are more geared toward language bindings; they don't make a copy, etc. There are also some known issues. See these emails for details on this huge patch: http://lists.freedesktop.org/archives/dbus/2004-December/001836.html http://lists.freedesktop.org/archives/dbus/2005-January/001922.html * dbus/dbus-marshal-*: all the new stuff * dbus/dbus-message.c: basically rewritten * dbus/dbus-memory.c (check_guards): with "guards" enabled, init freed blocks to be all non-nul bytes so using freed memory is less likely to work right * dbus/dbus-internals.c (_dbus_test_oom_handling): add DBUS_FAIL_MALLOC=N environment variable, so you can do DBUS_FAIL_MALLOC=0 to skip the out-of-memory checking, or DBUS_FAIL_MALLOC=10 to make it really, really, really slow and thorough. * qt/message.cpp: port to the new message args API (operator<<): use str.utf8() rather than str.unicode() (pretty sure this is right from the Qt docs?) * glib/dbus-gvalue.c: port to the new message args API * bus/dispatch.c, bus/driver.c: port to the new message args API * dbus/dbus-string.c (_dbus_string_init_const_len): initialize the "locked" flag to TRUE and align_offset to 0; I guess we never looked at these anyhow, but seems cleaner. * dbus/dbus-string.h (_DBUS_STRING_ALLOCATION_PADDING): move allocation padding macro to this header; use it to implement (_DBUS_STRING_STATIC): ability to declare a static string. * dbus/dbus-message.c (_dbus_message_has_type_interface_member): change to return TRUE if the interface is not set. * dbus/dbus-string.[hc]: move the D-BUS specific validation stuff to dbus-marshal-validate.[hc] * dbus/dbus-marshal-basic.c (_dbus_type_to_string): move here from dbus-internals.c * dbus/Makefile.am: cut over from dbus-marshal.[hc] to dbus-marshal-*.[hc] * dbus/dbus-object-tree.c (_dbus_decompose_path): move this function here from dbus-marshal.c
* 2004-11-25 Havoc Pennington <hp@redhat.com>Havoc Pennington2004-11-261-37/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The primary change here is to always write() once before adding the write watch, which gives us about a 10% performance increase. * dbus/dbus-transport-unix.c: a number of modifications to cope with removing messages_pending (check_write_watch): properly handle DBUS_AUTH_STATE_WAITING_FOR_MEMORY; adapt to removal of messages_pending stuff (check_read_watch): properly handle WAITING_FOR_MEMORY and AUTHENTICATED cases (unix_handle_watch): after writing, see if the write watch can be removed (unix_do_iteration): assert that write_watch/read_watch are non-NULL rather than testing that they aren't, since they aren't allowed to be NULL. check_write_watch() at the end so we add the watch if we did not finish writing (e.g. got EAGAIN) * dbus/dbus-transport-protected.h: remove messages_pending call, since it resulted in too much inefficient watch adding/removing; instead we now require that the transport user does an iteration after queueing outgoing messages, and after trying the first write() we add a write watch if we got EAGAIN or exceeded our max bytes to write per iteration setting * dbus/dbus-string.c (_dbus_string_validate_signature): add this function * dbus/dbus-server-unix.c (unix_finalize): the socket name was freed and then accessed, valgrind flagged this bug, fix it * dbus/dbus-message.c: fix several bugs where HEADER_FIELD_LAST was taken as the last valid field plus 1, where really it is equal to the last valid field. Corrects some message corruption issues. * dbus/dbus-mainloop.c: verbosity changes * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): handle OOM instead of aborting in one of the test codepaths * dbus/dbus-internals.c (_dbus_verbose_real): fix a bug that caused not printing the pid ever again if a verbose was missing the newline at the end (_dbus_header_field_to_string): add HEADER_FIELD_SIGNATURE * dbus/dbus-connection.c: verbosity changes; (dbus_connection_has_messages_to_send): new function (_dbus_connection_message_sent): no longer call transport->messages_pending (_dbus_connection_send_preallocated_unlocked): do one iteration to try to write() immediately, so we can avoid the write watch. This is the core purpose of this patchset (_dbus_connection_get_dispatch_status_unlocked): if disconnected, dump the outgoing message queue, so nobody will get confused trying to send them or thinking stuff is pending to be sent * bus/test.c: verbosity changes * bus/driver.c: verbosity/assertion changes * bus/dispatch.c: a bunch of little tweaks to get it working again because this patchset changes when/where you need to block.
* * doc/dbus-specification.xml: document ServiceOwnerChanged signal.Olivier Andrieu2004-09-241-361/+419
| | | | | | | * bus/driver.c, bus/driver.h, bus/services.c: Use ServiceOwnerChanged signal instead of ServiceCreated and ServiceDeleted. * bus/dispatch.c: update testcase for the new signal.
* * dbus/dbus-sysdeps.c (_dbus_user_at_console): fix memleak in OOM.Olivier Andrieu2004-09-171-1/+96
| | | | | | | | | | | * 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.
* 2004-08-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2004-08-101-1/+1
| | | | | * COPYING: switch to Academic Free License version 2.1 instead of 2.0, to resolve complaints about patent termination clause.
* * dbus/dbus-internals.h (_DBUS_SET_OOM):Olivier Andrieu2004-07-311-10/+15
| | | | | | | | * bus/utils.h (BUS_SET_OOM): use dbus_error_set_const instead of dbus_error_set. * bus/dispatch.c (check_send_exit_to_service): fix the test case, broken by the change in the _SET_OOM macros.
* 2004-07-19 David Zeuthen <david@fubar.dk>David Zeuthen2004-07-191-2/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-protocol.h: Add DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN * bus/dispatch.c: (check_get_connection_unix_user): Debug says GetProperty; but the method is called GetConnectionUnixUser (check_get_connection_unix_process_id): New function (bus_dispatch_test): Actually call check_get_connection_unix_user(); also call check_get_connection_unix_process_id() * bus/driver.c: (bus_driver_handle_get_connection_unix_process_id): New function, handles GetConnectionUnixProcessID on the org.freedesktop.DBus interface * dbus/dbus-auth.c: (handle_server_data_external_mech): Set pid from the credentials obtained from the socket * dbus/dbus-connection.c: (dbus_connection_get_unix_process_id): New function * dbus/dbus-connection.h: Add prototype for dbus_connection_get_unix_process_id * dbus/dbus-transport.c: (_dbus_transport_get_unix_process_id): New function * dbus/dbus-transport.h: Add prototype for _dbus_transport_get_unix_process_id
* * bus/driver.c (bus_driver_handle_get_connection_unix_user)Olivier Andrieu2004-06-281-0/+136
| | | | | | | | * dbus/bus.c (dbus_bus_get_unix_user) * doc/dbus-specification.xml: implement GetConnectionUnixUser method of org.freedesktop.DBus interface. * bus/dispatch.c: test case
* 2004-03-16 Richard Hult <richard@imendio.com>Richard Hult2004-03-161-1/+563
| | | | | | | | | | | | | | | | | | * bus/activation.c: (bus_activation_service_created), (bus_activation_send_pending_auto_activation_messages), (bus_activation_activate_service): * bus/activation.h: * bus/dispatch.c: (bus_dispatch), (check_nonexistent_service_auto_activation), (check_service_auto_activated), (check_segfault_service_auto_activation), (check_existent_service_auto_activation), (bus_dispatch_test): * bus/driver.c: (bus_driver_handle_activate_service): * bus/services.c: (bus_registry_acquire_service): * dbus/dbus-message.c: (dbus_message_set_auto_activation), (dbus_message_get_auto_activation): * dbus/dbus-message.h: * dbus/dbus-protocol.h: Implement auto-activation.
* 2003-12-02 Richard Hult <richard@imendio.com>Richard Hult2003-12-021-1/+1
| | | | | * Update AFL version to 2.0 throughout the source files to reflect the update that was done a while ago.
* 2003-10-28 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-10-281-17/+59
| | | | | | | | | | * bus/expirelist.c (do_expiration_with_current_time): detect failure of the expire_func due to OOM * bus/connection.c (bus_pending_reply_expired): return FALSE on OOM * bus/dispatch.c (check_send_exit_to_service): fix to handle the NoReply error that's now created by the bus when the service exits
* 2003-10-20 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-10-211-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hmm, make check is currently not passing. * doc/dbus-specification.xml: add requirement that custom type names follow the same rules as interface names. * dbus/dbus-protocol.h: change some of the byte codes, to avoid duplication and allow 'c' to be 'custom'; dict is now 'm' for 'map' * doc/dbus-specification.xml: update type codes to match dbus-protocol.h, using the ASCII byte values. Rename type NAMED to CUSTOM. Add type OBJECT_PATH to the spec. 2003-10-17 Havoc Pennington <hp@redhat.com> * bus/driver.c (create_unique_client_name): use "." as separator in base service names instead of '-' * dbus/dbus-string.c (_dbus_string_get_byte): allow getting nul byte at the end of the string * dbus/dbus-internals.h (_DBUS_LIKELY, _DBUS_UNLIKELY): add optimization macros since string validation seems to be a slow point. * doc/dbus-specification.xml: restrict valid service/interface/member/error names. Add test suite code for the name validation. * dbus/dbus-string.c: limit service/interface/member/error names to [0-9][A-Z][a-z]_ * dbus/dbus-connection.c (dbus_connection_dispatch): add missing format arg to verbose spew * glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): if not out of memory, return instead of g_error * test/test-service.c (path_message_func): support emitting a signal on request * dbus/dbus-bus.c (init_connections_unlocked): only fill in activation bus type if DBUS_BUS_ACTIVATION was set; default to assuming the activation bus was the session bus so that services started manually will still register. (init_connections_unlocked): fix so that in OOM situation we get the same semantics when retrying the function * test/test-service.c (main): change to use path registration, to test those codepaths; register with DBUS_BUS_ACTIVATION rather than DBUS_BUS_SESSION
* 2003-10-14 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-10-141-3/+3
| | | | | | | | | | | | | | * bus/connection.c: implement pending reply tracking using BusExpireList * bus/bus.c (bus_context_check_security_policy): verify that a reply is pending in order to allow a reply to be sent. Deny messages of unknown type. * bus/dbus-daemon-1.1.in: update to mention new resource limits * bus/bus.c (bus_context_get_max_replies_per_connection): new (bus_context_get_reply_timeout): new
* 2003-10-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-10-101-1/+2
| | | | | | | | | | | | | | | | | | | Make matching rules theoretically work (add parser). * bus/bus.c (bus_context_check_security_policy): fix up to handle the case where destination is explicitly specified as bus driver and someone else is eavesdropping. * bus/policy.c (bus_client_policy_check_can_receive): fix up definition of eavesdropping and assertion * tools/dbus-send.c (main): use dbus_message_type_from_string * bus/signals.c (bus_match_rule_parse): implement * dbus/dbus-message.c (dbus_message_type_from_string): new * dbus/dbus-errors.h (DBUS_ERROR_MATCH_RULE_INVALID): add
* 2003-09-21 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-09-211-70/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get matching rules mostly working in the bus; only actually parsing the rule text remains. However, the client side of "signal connections" hasn't been started, this patch is only the bus side. * dbus/dispatch.c: fix for the matching rules changes * bus/driver.c (bus_driver_handle_remove_match) (bus_driver_handle_add_match): send an ack reply from these method calls * glib/dbus-gproxy.c (dbus_gproxy_begin_call): fix order of arguments, reported by Seth Nickell * bus/config-parser.c (append_rule_from_element): support eavesdrop=true|false attribute on policies so match rules can be prevented from snooping on the system bus. * bus/dbus-daemon-1.1.in: consistently use terminology "sender" and "destination" in attribute names; fix some docs bugs; add eavesdrop=true|false attribute * bus/driver.c (bus_driver_handle_add_match) (bus_driver_handle_remove_match): handle AddMatch, RemoveMatch messages * dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST): get rid of broadcast service concept, signals are just always broadcast * bus/signals.c, bus/dispatch.c, bus/connection.c, bus/bus.c: mostly implement matching rules stuff (currently only exposed as signal connections)
* 2003-08-30 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-311-52/+10
| | | | | | | * dbus/dbus-connection.c: purge DBusMessageHandler * dbus/dbus-message-handler.c: remove DBusMessageHandler, just use callbacks everywhere
* 2003-08-30 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-311-15/+20
| | | | | | | | | | | | | | | | | | | | | * test/data/valid-config-files/system.d/test.conf: change to root for the user so warnings don't get printed * dbus/dbus-message.c: add dbus_message_get_path, dbus_message_set_path * dbus/dbus-object-tree.c (do_test_dispatch): add test of dispatching to a path * dbus/dbus-string.c (_dbus_string_validate_path): add * dbus/dbus-marshal.c (_dbus_demarshal_object_path): implement (_dbus_marshal_object_path): implement * dbus/dbus-protocol.h (DBUS_HEADER_FIELD_PATH): new header field to contain the path to the target object (DBUS_HEADER_FIELD_SENDER_SERVICE): rename DBUS_HEADER_FIELD_SENDER to explicitly say it's the sender service
* 2003-08-19 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-201-12/+29
| | | | | | | | | | | | | | | | * dbus/dbus-message.c (decode_string_field): support FIELD_SENDER (dbus_message_is_error): fix this function * bus/dbus-daemon-1.1: clarify logic on when <deny>/<allow> rules match * bus/policy.c (bus_client_policy_check_can_receive): fix code to reflect clarified man page (bus_client_policy_check_can_send): ditto * bus/session.conf.in: fixup * bus/system.conf.in: fixup
* 2003-08-18 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-08-181-83/+103
| | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix * dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix dumb bug created earlier (wrong order of args to decode_header_data()) * tools/dbus-send.c: port * tools/dbus-print-message.c (print_message): port * test/data/*messages: port all messages over * dbus/dbus-message-builder.c: support including message type * bus/driver.c: port over * bus/dispatch.c: port over to new stuff * dbus/dbus-connection.c (_dbus_connection_new_for_transport): rename disconnect signal to "Disconnected"
* 2003-08-17 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-181-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't compile yet, but syncing up so I can hack on it from work. What are branches for if not broken code? ;-) * dbus/dbus-protocol.h: remove DBUS_HEADER_FIELD_NAME, add DBUS_HEADER_FIELD_INTERFACE, DBUS_HEADER_FIELD_MEMBER, DBUS_HEADER_FIELD_ERROR_NAME * dbus/dbus-hash.c: Introduce DBUS_HASH_TWO_STRINGS as hack to use for the interface+member pairs (string_hash): change to use g_str_hash algorithm (find_direct_function, find_string_function): refactor these to share most code. * dbus/dbus-message.c: port all of this over to support interface/member fields instead of name field * dbus/dbus-object-registry.c: port over * dbus/dbus-string.c (_dbus_string_validate_interface): rename from _dbus_string_validate_name * bus/dbus-daemon-1.1: change file format for the <deny>/<allow> stuff to match new message naming scheme * bus/policy.c: port over * bus/config-parser.c: parse new format
* 2003-08-12 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-121-4/+8
| | | | | | | | | | | | | | | | | | * bus/dispatch.c (bus_dispatch): make this return proper DBusHandlerResult to avoid DBUS_ERROR_UNKNOWN_METHOD * dbus/dbus-errors.c (dbus_set_error): use _dbus_string_append_printf_valist * dbus/dbus-string.c (_dbus_string_append_printf_valist) (_dbus_string_append_printf): new * dbus/dbus-errors.h (DBUS_ERROR_UNKNOWN_MESSAGE): change to UNKNOWN_METHOD * dbus/dbus-connection.c (dbus_connection_dispatch): handle DBUS_HANDLER_RESULT_NEED_MEMORY; send default error reply if a message is unhandled.
* 2003-08-11 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-121-1/+1
| | | | | | | | | | * bus/test.c (client_disconnect_handler): change to return HANDLED (would have been REMOVE_MESSAGE) * dbus/dbus-object.h (enum DBusHandlerResult): rename to HANDLED/NOT_YET_HANDLED instead of REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it should be used.
* 2003-08-10 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-111-18/+18
| | | | | | | | | | | | | | | | | | | | | | * tools/dbus-send.c (main): add --type argument, for now supporting only method_call and signal types. * tools/dbus-print-message.c: print message type * dbus/dbus-connection.c (_dbus_connection_new_for_transport): init connection->objects * doc/dbus-specification.sgml: fix sgml * bus/*.c: port over to object-instance API changes * test/test-service.c: ditto * dbus/dbus-message.c (dbus_message_create_header): allow #NULL name, we will have to fix up the rest of the code to also handle this (dbus_message_new): generic message-creation call (set_string_field): allow appending name field
* 2003-06-22 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-06-221-41/+6
| | | | | | | | | | | | | | | | | | | | | * dbus/dbus-dataslot.c (_dbus_data_slot_allocator_unref) (_dbus_data_slot_allocator_alloc): rework these to keep a reference count on each slot and automatically manage a global slot ID variable passed in by address * bus/bus.c: convert to new dataslot API * dbus/dbus-bus.c: convert to new dataslot API * dbus/dbus-connection.c: convert to new dataslot API * dbus/dbus-server.c: convert to new dataslot API * glib/dbus-gmain.c: ditto * bus/test.c: ditto * bus/connection.c: ditto
* 2003-04-27 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-271-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unbreak my code... * dbus/dbus-transport.c (_dbus_transport_get_dispatch_status): report correct status if we finish processing authentication inside this function. * bus/activation.c (try_send_activation_failure): use bus_transaction_send_error_reply * bus/connection.c (bus_connection_get_groups): return an error explaining the problem * bus/bus.c (bus_context_check_security_policy): implement restriction here that inactive connections can only send the hello message. Also, allow bus driver to send anything to any recipient. * bus/connection.c (bus_connection_complete): create the BusClientPolicy here instead of on-demand. (bus_connection_get_policy): don't return an error * dbus/dbus-message.c (dbus_message_new_error_reply): allow NULL sender field in message being replied to * bus/bus.c (bus_context_check_security_policy): fix silly typo causing it to return FALSE always * bus/policy.c (bus_client_policy_check_can_send): fix bug where we checked sender rather than destination
* 2003-04-24 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-241-26/+26
| | | | | | | | | | | * bus/dispatch.c: somehow missed some name_is * dbus/dbus-timeout.c (_dbus_timeout_set_enabled) (_dbus_timeout_set_interval): new * bus/connection.c (bus_connections_setup_connection): record time when each connection is first set up, and expire them after the auth timeout passes.
* 2003-04-24 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-241-2/+2
| | | | | | | * dbus/dbus-message.c (dbus_message_name_is): rename (dbus_message_service_is): rename (dbus_message_sender_is): rename (dbus_message_get_service): rename
* 2003-04-24 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-241-10/+10
| | | | | | | | | | | | | | | | * configure.in: add --enable-checks * dbus/dbus-message.c (dbus_message_new): reverse name/service arguments * dbus/dbus-connection.c (dbus_connection_preallocate_send): fix to use thread locks. (_dbus_connection_handler_destroyed_locked): move some private functions into proper docs group * dbus/dbus-internals.h: add _dbus_return_if_fail, _dbus_return_val_if_fail Throughout: use dbus_return_if_fail
* 2003-04-19 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-191-4/+1
| | | | | | | | | | | | | | * bus/driver.c (bus_driver_handle_hello): check limits and return an error if they are exceeded. * bus/connection.c: maintain separate lists of active and inactive connections, and a count of each. Maintain count of completed connections per user. Implement code to check connection limits. * dbus/dbus-list.c (_dbus_list_unlink): export * bus/bus.c (bus_context_check_security_policy): enforce a maximum number of bytes in the message queue for a connection
* 2003-04-18 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-auth.c (record_mechanisms): memleak fixes * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): fix some memleaks * dbus/dbus-keyring.c (add_new_key): fix a memleak, and on realloc be sure to update the pointer in the keyring * dbus/dbus-string.c (_dbus_string_zero): compensate for align offset to avoid writing to unallocated memory * dbus/dbus-auth.c (process_rejected): return FALSE if we fail to try the next mechanism, so we properly handle OOM * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): fix double-free on OOM. (_dbus_keyring_new): fix OOM bug (_dbus_keyring_new_homedir): always set error; impose a maximum number of keys we'll load from the file, mostly to speed up the test suite and make its OOM checks more useful, but also for general sanity. * dbus/dbus-auth.c (process_error_server): reject authentication if we get an error from the client (process_cancel): on cancel, send REJECTED, per the spec (process_error_client): send CANCEL if we get an error from the server.
* 2003-04-18 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-181-1/+1
| | | | | | | | | | | | | | | | | | | * dbus/dbus-mainloop.c (_dbus_loop_iterate): fix UMR in verbose debug spew * dbus/dbus-auth.c (handle_client_data_cookie_sha1_mech): fix OOM handling problem * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): only whine about DBUS_TEST_HOMEDIR once * bus/Makefile.am (TESTS_ENVIRONMENT): put DBUS_TEST_HOMEDIR in the environment * bus/dispatch.c (bus_dispatch_sha1_test): actually load sha1 config file so we test the right thing Throughout: assorted docs improvements
* 2003-04-17 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-171-2/+2
| | | | | | | | | | | * dbus/dbus-mainloop.c (_dbus_loop_iterate): fix logic so that if there was an OOM watch we skipped, we always return TRUE so we iterate again to have a look at it again. Fixes test suite hang. Code rearrangement also lets us lose some memset and only iterate over callbacks once. * bus/driver.c (bus_driver_handle_message): sense of test for reply was backward
* 2003-04-14 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-141-3/+47
| | | | | | | | | | | | | | * dbus/dbus-userdb.c: user database abstraction, mostly to get caching, but at some point we might want to be able to use a different database. * bus/dispatch.c (bus_dispatch_sha1_test): add a test that uses SHA1 conf file to test the sha1 auth mechanism, since the regular test always uses EXTERNAL when available. * configure.in, test/data/valid-config-files/debug-allow-all-sha1.conf.in: add conf file that requires use of sha1 auth
* 2003-04-13 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-141-87/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-mainloop.c: fix some reentrancy issues by refcounting callbacks * test/data/valid-config-files/debug-allow-all.conf.in: allow all users * dbus/dbus-transport.c (_dbus_transport_get_dispatch_status): fix to only recover unused bytes if we're already authenticated (_dbus_transport_get_is_authenticated): fix to still mark us authenticated if there are unused bytes. * bus/dispatch.c: implement security policy checking * bus/connection.c (bus_transaction_send_from_driver): new * bus/bus.c (bus_context_check_security_policy): new * bus/dispatch.c (send_service_nonexistent_error): delete this, now we just set the DBusError and it gets converted to an error reply. * bus/connection.c (allow_user_function): enable code using actual data from the config file * bus/policy.c (list_allows_user): handle wildcard rules for user/group connection perms
* 2003-04-11 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-111-7/+29
| | | | | | | | | * bus/dispatch.c (check_existent_service_activation): accept a no memory error in a place we didn't before * bus/test.c (bus_test_run_everything): remove hacky "do it twice in case the first one failed," since the test suite is less broken now.
* 2003-04-10 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-111-15/+113
| | | | | | | | * bus/dispatch.c (check_segfault_service_activation): add test for launching an executable that just crashes. * test/test-segfault.c (main): try setting coredumpsize to 0 so we don't leave a million cores. We'll see how portable this is.
* 2003-04-10 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-111-29/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-connection.c (dbus_connection_flush): don't spin on the connection if it's disconnected * bus/activation.c (bus_activation_service_created): use new transaction features to roll back removal of pending activation if we don't successfully create the service after all. Don't remove pending activation if the function fails. * dbus/dbus-list.c (_dbus_list_insert_before_link) (_dbus_list_insert_after_link): new code to facilitate services.c fixes * dbus/dbus-hash.c (_dbus_hash_table_insert_string_preallocated): new functionality, so we can preallocate the ability to insert into a hash table. * bus/connection.c (bus_transaction_add_cancel_hook): new function allowing us to put custom hooks in a transaction to be used for cancelling said transaction * doc/dbus-specification.sgml: add some discussion of secondary service owners, and disallow zero-length service names * bus/services.c (bus_registry_acquire_service): new function, splits out part of bus_driver_handle_acquire_service() and fixes a bug where we didn't remove the service doing the acquiring from the secondary queue if we failed to remove the current owner from the front of the queue.
* 2003-04-10 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-101-107/+201
| | | | | | | | | | | | | | | | | | | | * bus/dispatch.c: lots of fixes * dbus/dbus-mainloop.c (_dbus_loop_dispatch): export (_dbus_loop_iterate): remove old "quit if no callbacks" code, that was crack, broke the test service. * dbus/dbus-transport.c (_dbus_transport_open): fix error handling to avoid piling up errors if we get a failure on the first address. * dbus/dbus-internals.c (_dbus_real_assert_not_reached): include pid in assertion failures. * dbus/dbus-mainloop.c (_dbus_loop_iterate): use static arrays up to some fixed size of file descriptor array. Don't return TRUE anytime a timeout exists, that led to lots of busy loop silliness in the tests.
* -Havoc Pennington2003-04-101-86/+223
|
* 2003-04-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-091-4/+14
| | | | | | | | | | | | | * dbus/dbus-bus.c (dbus_bus_register): fix up error handling and a memory leak * bus/dispatch.c (check_service_activated): fix bug in test * dbus/dbus-mainloop.c (check_timeout): fix this up * dbus/dbus-internals.c (_dbus_verbose_real): include PID in verbose output so we can sort out output from different processes, e.g. in the activation case.
* 2003-04-07 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-071-5/+278
| | | | | | | | | | | | | * doc/dbus-specification.sgml: require that base service names start with ':' and that the base service is created/deleted as first and last things a connection does on the bus * bus/dispatch.c (check_existent_service_activation): lots more work on the activation test; it doesn't fully pass yet... * test/test-service.c (main): fix so we don't memleak the connection to the message bus (filter_func): accept a message asking us to exit