summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-connection.c
Commit message (Collapse)AuthorAgeFilesLines
* Correct timeout handlingJames Westby2009-10-011-8/+6
| | | | | | | | | | | | The timeout handling code subtracts the elapsed time from the timeout each time a message is received, which drastically reduces the timeout in circumstances such as service activation. Correct so that the timeout is never modified, and the elapsed time instead subtracted where necessary. Signed-off-by: James Westby <jw+debian@jameswestby.net> Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* Merge branch 'fd-passing'Thiago Macieira2009-07-161-18/+231
|\ | | | | | | | | | | | | Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
| * unix-fd: add logic to count unix fds the same way as allocated memoryLennart Poettering2009-05-201-9/+110
| | | | | | | | This make all counters count both bytes of memory and unix fds.
| * unix-fd: when sending a message with unix fds verify that the connection can ↵Lennart Poettering2009-05-201-7/+69
| | | | | | | | | | | | | | | | do it Not all of the send function flavours allow returning proper error codes. For the cases where this is not easily possible the client should call dbus_connection_can_send_type() first.
| * unix-fd: introduce dbus_connection_can_send_type()Lennart Poettering2009-05-201-2/+48
| | | | | | | | | | | | | | | | This is just a wrapper around _dbus_transport_can_pass_unix_fd() however it is more generic. The reason for keeping this generic is to ease later addition of more types without having to add a new API for that.
| * sysdeps-unix: if MSG_NOSIGNAL is available don't touch SIGPIPE by defaultLennart Poettering2009-05-151-0/+4
| | | | | | | | If we can use MSG_NOSIGNAL we don't have to play games with SIGPIPE
* | Bug 12484 - Ensure initialized variable in dbus_connection_remove_filterKimmo Hämäläinen2009-07-131-0/+1
| | | | | | | | Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
* | Bug 21161 - Update the FSF addressTobias Mueller2009-07-101-1/+1
| | | | | | | | | | | | No comment. Signed-off-by: Colin Walters <walters@verbum.org>
* | Fix issue where timeouts can overflow.Scott James Remnant2009-05-281-14/+7
| | | | | | | | | | | | | | | | | | * dbus/dbus-connection.c (_dbus_connection_block_pending_call): Rework the timeout math so instead of calculating an end time, which may overflow, we instead calculate the elapsed time which is always smaller than the boundaries. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | Update documentation now that INT_MAX means no timeout.Scott James Remnant2009-05-281-6/+4
| | | | | | | | | | | | | | | | * dbus/dbus-connection.c (dbus_connection_send_with_reply): Fix documentation now that INT_MAX will not be clamped. (dbus_connection_send_with_reply_and_block): Update documentation too. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | Allow a pending call to block foreverScott James Remnant2009-05-281-14/+48
| | | | | | | | | | | | | | | | * dbus/dbus-connection.c (_dbus_connection_block_pending_call): Allow the pending call to have no timeout, in which case we simply block until we complete, have data or get disconnected. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | Make sure a pending call timeout isn't assumed.Scott James Remnant2009-05-281-14/+29
|/ | | | | | | | | | * dbus/dbus-connection.c (_dbus_connection_attach_pending_call_unlocked): Don't assume that the pending call has a timeout. (connection_timeout_and_complete_all_pending_call_unlocked): check that the timeout was actually added before removing it; this safeguards us if the pending call doesn't have a timeout. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* Bug 19567 - Make marshaling code usable without DBusConnectionWilliam Lachance2009-04-211-3/+3
| | | | | | | | | | Some projects want to reuse the DBus message format, without actually going through a DBusConnection. This set of changes makes a few functions from DBusMessage public, and adds a new function to determine the number of bytes needed to demarshal a message. Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 19502 - Sparse warning cleanupsKjartan Maraas2009-04-211-2/+2
| | | | | | | This patch makes various things that should be static static, corrects some "return FALSE" where it should be NULL, etc. Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 20494 - Fix signed confusion for dbus_message_get_reply_serial returnJohan Gyllenspetz2009-03-171-2/+2
| | | | | | | We were incorrectly converting the serial to a signed integer and comparing it to -1. Signed-off-by: Colin Walters <walters@verbum.org>
* Merge branch 'dbus-1.2'Thiago Macieira2008-06-071-6/+5
|\
| * Fix inverted return value from dbus_connection_read_write()Oswald Buddenhagen2008-06-071-4/+6
| | | | | | | | | | | | | | | | | | * dbus/dbus-connection.c (_dbus_connection_read_write_dispatch): The double negation re no_progress_possible was obviously too confusing: the path for dispatch = FALSE would return an inverted status. So make it progress_possible and fix the logic. Signed-off-by: Thiago Macieira <thiago@kde.org>
* | Bug 15740: Solaris/ADT auditing support (simon zheng)Colin Walters2008-06-051-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bus/driver.c: Add GetAdtAuditSessionData method which returns audit data for a connection. * configure.in: Detect ADT auditing support * dbus/dbus-auth.c: Read ADT auditing creds. * dbus/dbus-connection.c: Implement dbus_connection_get_adt_audit_session_data. * dbus/dbus-connection.h: Export it. * dbus/dbus-credentials.c: Add support for gathering adt_audit_data and retrieving it via _dbus_credentials_get_adt_audit_data. * dbus/dbus-credentials.h: Add DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID. * dbus/dbus-protocol.h: New error DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN. * dbus/dbus-sysdeps.c: Support for reading audit credentials via ADT API. * dbus/dbus-transport.c: New function _dbus_transport_get_adt_audit_session_data to retrieve credentials. * dbus/dbus-transport.h: Export it.
* | Bug 15635: Hold a reference during read/write dispatch (Scott James Remnant)Colin Walters2008-05-301-0/+10
| | | | | | | | | | | | | | | | * dbus/dbus-connection.c (_dbus_connection_read_write_dispatch): Reference the D-Bus connection during the function call since we call other functions that may free the last reference and we still expect to be able to check the connection after they return to decide our own return value.
* | Bug 15571: Clean up GUID-less connections correctly (Scott James Remnant)Colin Walters2008-05-301-3/+8
|/ | | | | | | | | * dbus/dbus-connection.c (connection_forget_shared_unlocked): Remove shared connections which lack a GUID from the list that caches those, otherwise references to them will remain after they have been freed. * test/name-test/test-privserver-client.c: Update test to try GUID-less connections too.
* Prevent a crash in some applications due to timers leaking after theThiago Macieira2008-05-171-0/+7
| | | | | | | DVusPendingCall object was freed. * dbus-connection.c: Remove the timer for the pending call's timeout in case the reply has timed out in blocking code. This fixes bug 15684.
* modify dbus_connection_send documentationJohn (J5) Palmieri2008-04-031-6/+12
| | | | | | | | * dbus/dbus-connection.c (dbus_connection_send): add documentation to describe when to call dbus_connection_flush and dbus_connection_unref after a call to dbus_connection_send is made Initial wording by Stanislav Brabec <sbrabec at suse.cz> (fd.o bug#13558)
* correctly unref connections without guids during shutdownJohn (J5) Palmieri2008-02-261-13/+45
| | | | | | | | | | * dbus/dbus-connection.c (close_connection_on_shutdown): new method split out from shared_connections_shutdown (shared_connections_shutdown): shutdown all shared connections without guids (_dbus_connection_ref_unlocked): handle OOM when prepending no guid connections to the shared_connections_no_guid list * Patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com>
* don't check for < 0 on an unsigned variable (FDO Bug #12924)John (J5) Palmieri2008-01-151-3/+3
| | | | | | | | | 2008-01-15 John (J5) Palmieri <johnp@redhat.com> * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> * dbus/dbus-connection.c (_dbus_connection_get_next_client_serial): don't check for < 0 on an unsigned variable (FDO Bug #12924)
* fix possible crash if pending_return is NULL (FDO Bug #12673)John (J5) Palmieri2008-01-151-2/+0
| | | | | | | | | 2008-01-15 John (J5) Palmieri <johnp@redhat.com> * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> * dbus/dbus-connection.c (dbus_connection_send_with_reply): fix possible crash if pending_return is NULL (FDO Bug #12673)
* fix some curly braces that were on the wrong lineHavoc Pennington2007-12-181-4/+5
| | | | | | | 2007-12-18 Havoc Pennington <hp@redhat.com> * dbus/dbus-connection.c (_dbus_connection_block_pending_call): fix location of curly braces
* Use DBUS_ERROR_INIT instead of dbus_error_init wherever it's clearly equivalentSimon McVittie2007-10-111-10/+4
|
* Add dbus_connection_try_register_object_path and ↵Simon McVittie2007-10-101-4/+121
| | | | dbus_connection_try_register_fallback, to make object path registration less painful for bindings
* 2007-07-13 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-07-141-1/+1
| | | | * Add indent-tabs-mode: nil to all file headers.
* 2007-07-10 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-07-101-3/+7
| | | | | | | * dbus/dbus-connection.c (struct DBusConnection): Fix from Olivier Hochreutiner to avoid trying to protect individual bits in a word with different locks (make dispatch_acquired and io_path_acquired dbus_bool_t rather than bitfields)
* 2007-06-18 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-181-0/+45
| | | | | | | | | | | | | | * doc/dbus-specification.xml: document org.freedesktop.DBus.GetId() * bus/driver.c (bus_driver_handle_get_id): implement org.freedesktop.DBus.GetId() * bus/bus.c (bus_context_new): generate a unique ID for each bus context * dbus/dbus-connection.c (dbus_connection_get_server_id): new function * dbus/dbus-bus.c (dbus_bus_get_id): new function * dbus/dbus-server.c (dbus_server_get_id): new function
* 2007-06-18 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-181-8/+9
| | | | | | | | | * dbus/dbus-watch.c (dbus_watch_get_socket) (dbus_watch_get_unix_fd): new API to match DBusConnection (dbus_watch_get_fd): deprecate this Throughout: just s/dbus_watch_get_fd/dbus_watch_get_socket/g for now since all the transports use sockets anyway
* 2007-06-12 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-121-1/+71
| | | | | | | | | | | | | * dbus/dbus-auth.c (sha1_handle_second_client_response) (handle_server_data_anonymous_mech): add the process ID from socket credentials, if available, even if not using EXTERNAL * dbus/dbus-transport.c (auth_via_default_rules): support allow_anonymous flag * dbus/dbus-connection.c (dbus_connection_get_is_anonymous) (dbus_connection_set_allow_anonymous): new API for controlling anonymous access
* 2007-06-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-091-24/+117
| | | | | | | | | | | | | | | | | | | * bus/policy.c (bus_policy_create_client_policy): gracefully continue if the connection has no unix user - just don't apply any unix user dependent rules. * bus/config-parser.c: remove dbus-userdb.h usage * bus/bus.c: remove dbus-userdb.h usage * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): support Windows user function; also, fix the logic for checking auth as root in the default auth code (broken in the previous commit) * dbus/dbus-connection.c (dbus_connection_set_windows_user_function): new function (dbus_connection_get_windows_user): new function
* 2006-11-14 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-11-151-57/+0
| | | | | | | | * dbus/dbus-misc.c, dbus/dbus-misc.h: Move dbus_get_local_machine_id() to its own file, no substantive changes. There are a couple other things we might want to add that are "misc" so moving out of dbus-connection.[hc] which is big enough already.
* 2006-11-14 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-11-151-1/+4
| | | | | | | | | | | | | | * dbus/dbus-internals.c (_dbus_generate_uuid): The spec said the UUID had the timestamp last, but the implementation had it first; move it to last since I think it's a tiny bit nicer (easier to compare at a glance, faster to sort, less code), and will not cause any practical compatibility problems. Also, always convert the timestamp to big endian. * doc/dbus-specification.xml: Clean up the docs on the UUID. * tools/dbus-uuidgen.1: more prominently say it is not suitable as a replacement for regular uuidgen/RFC4122.
* 2006-10-27 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-281-1/+11
| | | | | * dbus/dbus-connection.c (dbus_connection_open_private): document how to choose shared vs. private connections
* 2006-10-27 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-281-5/+14
| | | | | | | | | | | | | | | | | | | | | * dbus/dbus-test.c: enclose more of the file in the DBUS_BUILD_TESTS check. * dbus/dbus-sysdeps-pthread.c (PTHREAD_CHECK): fix for DBUS_DISABLE_ASSERT case. * dbus/dbus-connection.c (dbus_connection_get_unix_user): document that it only works on the server side * dbus/dbus-bus.c: add a global lock covering the BusData we attach to each connection (internal_bus_get): lock our access to the BusData (dbus_bus_register): lock the entire registration process with _DBUS_LOCK(bus_datas). If we get the lock and registration is already complete, silently return (vs. previous behavior of aborting). (dbus_bus_set_unique_name): lock the BusData (dbus_bus_get_unique_name): lock the BusData
* 2006-10-26 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-271-4/+15
| | | | | | | | | | | | | * dbus/dbus-threads.[hc]: Documentation improvements. Clarify how condition variables relate to recursive mutexes. * dbus/dbus-sysdeps-pthread.c, dbus/dbus-sysdeps-win-thread.c, dbus/dbus-threads.c: Split the platforms-specific thread implementations into their own files. * dbus/dbus-sysdeps-pthread.c (_dbus_pthread_condvar_wait_timeout): invert the return value, it was backward. Not that anything uses it.
* * dbus/dbus-connection.c (_dbus_connection_open_internal): FixThiago Macieira2006-10-261-32/+21
| | | | | | | bug 8780: the connection lock is only required while recording the shared connection, so protect only that code section. Don't require connection_lookup_shared to return a locked connection.
* 2006-10-21 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-211-32/+48
| | | | | * Documentation! Whee! Doxygen now 100% silent. If you make it angry again, you will be punished.
* 2006-10-21 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-211-1/+4
| | | | | * More documentation - all public API now documented according to Doxygen
* 2006-10-21 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-211-7/+11
| | | | * Document a bunch of undocumented stuff
* 2006-10-21 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-211-3/+6
| | | | | | | * dbus/dbus-message.h: put #ifndef DBUS_DISABLE_DEPRECATED around dbus_message_iter_get_array_len(). * throughout: documentation improvements.
* fix typoHavoc Pennington2006-10-211-1/+1
|
* 2006-10-20 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-201-70/+133
| | | | | | | | | | | | | * doc/TODO: remove the int64 thing from 1.0 since it doesn't matter, and the message-loader-breaker thing since nobody is going to do it. Add an item to 1.0 about supporting recursive locks in dbus_threads_init_default() though, since it should be easy. * dbus/dbus-connection.c (_dbus_connection_read_write_dispatch): Fix this in the !dispatch case to avoid busy-looping after disconnection * More misc docs improvements
* 2006-10-19 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-201-517/+518
| | | | | * more Doxygen-related fixes (lots of moving things from the public to internal section in dbus-connection.c)
* 2006-10-19 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-201-41/+65
| | | | * Fix a pile of Doxygen warnings and missing docs
* 2006-10-17 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-171-12/+11
| | | | | | * dbus/dbus-internals.c (_dbus_warn_check_failed): new function to be used for return_if_fail type warnings; prefixes the pid, and fatal by default.
* 2006-10-13 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-131-2/+6
| | | | | | * dbus/dbus-connection.c (dbus_connection_send_with_reply_and_block): fix to handle closed connections, from Tambet Ingo bug #8631