summaryrefslogtreecommitdiffstats
path: root/dbus
Commit message (Collapse)AuthorAgeFilesLines
* move desktop file parser from bus/ to dbus/Lennart Poettering2009-10-173-8/+858
| | | | | | We want to make use of it for reading the ConsoleKit database which will need to be implemented in dbus/dbus-userdb-util.c, so let's move this to dbus/.
* 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>
* Fix compilation on non-Linux: the F_DUPFD_CLOEXEC check was reversedBenjamin Reed2009-07-291-1/+1
| | | | Signed-off-by: Thiago Macieira <thiago@kde.org>
* missing HAVE_UNIX_FD_PASSING checkBenjamin Reed2009-07-291-0/+4
| | | | Signed-off-by: Thiago Macieira <thiago@kde.org>
* Merge branch 'fd-passing'Thiago Macieira2009-07-1641-296/+1980
|\ | | | | | | | | | | | | Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
| * bus: don't forward messages with unix fds on connections that don't support itLennart Poettering2009-05-213-1/+16
| | | | | | | | | | | | This simply verifies that we forward unix fds only on connection that support it. We willr eturn an error if a client attempts to send a message with unix fds to another client that cannot do it.
| * doxygen: document that we don't support reading/writing arrays of unix fds ↵Lennart Poettering2009-05-201-32/+61
| | | | | | | | in once piece right now
| * unix-fd: add logic to count unix fds the same way as allocated memoryLennart Poettering2009-05-2011-107/+353
| | | | | | | | This make all counters count both bytes of memory and unix fds.
| * byteswap: make use of glibc specific bytswap primitivesLennart Poettering2009-05-201-0/+18
| | | | | | | | | | | | glibc knows three bswap_{16|32|64}() calls that internally make use of a gcc extension to implement faster byteswapping. We should make use of it if we can.
| * atomic: implement atomic operations based on gcc's __sync extensionLennart Poettering2009-05-203-26/+14
| | | | | | | | | | | | | | | | | | | | | | Newer gccs and intel ccs support a __sync extension for making use of atomic operations. This patch replaces the handcrafted x86 atomic operation support with usage of __sync. __sync is supported by more processors and by more compilers than the old assembler code. Also, this extension has been available on gcc for quite a while now for x86, so replacing the old assembler code should only be a loss when very old compiilers are used.
| * memset: replace memset() by _DBUS_ZERO where applicableLennart Poettering2009-05-204-8/+8
| |
| * auth: add fd passing negotiation supportLennart Poettering2009-05-205-31/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds two new directives to the auth protocol: NEGOTIATE_UNIX_FD is sent by the client after the authentication was sucessful, i.e. OK was received. AGREE_UNIX_FD is then sent by the server if it can do unix fd passing as well. ERROR is returned when the server cannot or is unwilling to do unix fd passing. This should be compatible with existing D-Bus implementations which will naturally return ERROR on NEGOTIATE_UNIX_FD.
| * cloexec: set all sockets that are created with SOCK_CLOEXECLennart Poettering2009-05-205-16/+58
| | | | | | | | | | | | Since all socket users enable FD_CLOEXEC anyway we can just do that in _dbus_open_socket() and be done with it for all cases. By side effect this allows us to use SOCK_CLOEXEC and hence close the CLOEXEC race.
| * cloexec: make use of pipe2(O_CLOEXEC) when availableLennart Poettering2009-05-201-5/+29
| | | | | | | | This should fix another CLOEXEC race.
| * build-system: define _GNU_SOURCE centrallyLennart Poettering2009-05-201-1/+1
| | | | | | | | | | Instead of having everyone define _GNU_SOURCE and similar macros seperately, simply do so centrally by using AC_USE_SYSTEM_EXTENSIONS
| * cloexec: set FD_CLOEXEC for all full duplex pipesLennart Poettering2009-05-203-9/+26
| | | | | | | | | | | | | | All users of full duplex pipes enable FD_CLOEXEC later anyway so let's just do it as part of _dbus_full_duplex_pipe. By side effect this allows to make use of SOCK_CLOEXEC which fixes a race when forking/execing from a different thread at the same time as we ar in this function.
| * 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-202-2/+50
| | | | | | | | | | | | | | | | 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.
| * unix-fd: add message encoding/decoding for unix fdsLennart Poettering2009-05-209-43/+680
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When appending unix fds to the message a new entry in the fd array will be allocated and the index to it will be written to the message payload. When parsing unix fds from the message the index will be read from the payload and then looked up in the fd array. When we read fds we put them in a queue first. Since each message knows how many fds are attached to it we will then pop enough fds from this queue each time we decode a message from the stream. This should make sending and receiving more portable since we don't make any strong requirements on the exact semantics of the SCM_RIGHTS implementation: as long as fds are recieved in order, none or lost and the arrive at the same time as at least one byte from the actual message dat we should be able to handle them correctly.
| * unix-fd: add basic marshalling code for unix fdsLennart Poettering2009-05-206-2/+25
| | | | | | | | | | This is actually pretty boring since we store our fds as indexes that are stored as uint32_t's.
| * unix-fd: introduce basic protocol definitionsLennart Poettering2009-05-201-1/+22
| | | | | | | | | | | | | | | | | | We introduce a new type code for the unix fds. The data stored in unix fd fields will be an integer index into the array of fds that are attached to a specific message. We also introduce a new header field that stores how many fds belong to the message. And finally we introduce a new error for messages where the payload and the meta data (i.e. unix fds read for it) don't match up.
| * sysdeps-unix: add basic IO primitives for unix fd passingLennart Poettering2009-05-202-1/+258
| | | | | | | | | | | | | | | | | | | | | | | | This introduces three new functions: _dbus_read_socket_with_unix_fds _dbus_write_socket_with_unix_fds _dbus_read_socket_with_unix_fds_two These work exactly like their counterpart sans 'with_unix_fds' except that they also send/recieve file descriptors along with the actual payload data.
| * sysdeps-unix: introduce _dbus_socket_can_pass_unix_fd()Lennart Poettering2009-05-202-0/+34
| | | | | | | | | | | | This function can be used to check if a socket can be used to pass file descriptors. On platforms that don't support this at all this is hardcoded to return FALSE.
| * sysdeps-unix: introduce _dbus_dup()Lennart Poettering2009-05-202-1/+45
| | | | | | | | | | | | | | This is a simple wrapper around dup()-like functionality. Also handles CLOEXEC and makes sure we don't interfere with the standard I/O file descriptors 0, 1 and 2.
| * 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
| * sysdeps-unix: Use MSG_NOSIGNAL when availableLennart Poettering2009-05-151-0/+61
| | | | | | | | | | | | | | | | | | On Linux send()/sendmsg() know the special flag MSG_NOSIGNAL which if set makes sure that no SIGPIPE signal is raised when we write to a socket that has been disconnected. By using this flag we don't have to play games with SIGPIPE which is pretty ugly stuff since it touches the global process context.
| * memory: remove semicolons from macrosLennart Poettering2009-05-151-2/+2
| | | | | | | | | | Due to some unknown reasons the dbus_new() macros had a semicolon at the end which makes it impossible to use them in some situations.
| * build-system: get rid of config.h inclusion checksLennart Poettering2009-05-155-20/+0
| | | | | | | | | | | | | | | | | | These header files include config.h explicitly anyway. These checks are hence pointless. Of course one could argue that including config.h from header files sucks, but D-Bus generally seems not to have a problem with that, so let's unify this.
* | Cope with dbus-launch not being in DBUS_BINDIRColin Walters2009-07-141-11/+19
| | | | | | | | | | | | | | | | | | This is a temporary hack for systems which use DBUS_BINDIR=/bin, but then move dbus-launch back into /usr/bin. Longer term, we should explicitly support this in upstream code, or even better figure out how to move dbus-launch into /bin (e.g. dynamically load libX11 if available), or have a --with-x11-tools configure option.
* | Bug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)Hasso Tepper2009-07-131-15/+19
| | | | | | | | | | | | | | | | Fixes dbus on FreeBSD and DragonFly systems. The patch is obtained from FreeBSD ports tree. Signed-off-by: Colin Walters <walters@verbum.org>
* | Bug 19446 - HaikuOS supportGrzegorz Dąbrowski2009-07-131-0/+13
| | | | | | | | Signed-off-by: Colin Walters <walters@verbum.org>
* | Bug 896 - Avoid race conditions reading message from exited processColin Walters2009-07-135-8/+46
| | | | | | | | | | | | | | | | | | | | | | | | Patch based on extensive work from Michael Meeks <michael.meeks@novell.com>, thanks to Dafydd Harries <dafydd.harries@collabora.co.uk>, Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> and others. The basic idea with this bug is that we effectively ignore errors on write. Only when we're done reading from a connection do we close down a connection. This avoids a race condition where if a process (such as dbus-send) exited while we still had data to read in the buffer, we'd miss that data.
* | Bug 14259 - Refactor _dbus_get_autolaunch_addressColin Walters2009-07-131-70/+114
| | | | | | | | | | | | Split out the process-launching code, which can be reused for other applications; in particular, a forthcoming patch to parse output from launchd for MacOS X.
* | Bug 14259 - Make session address lookup system-dependentColin Walters2009-07-134-11/+107
| | | | | | | | | | | | | | On some platforms such as MacOS X and Windows, we can't depend on an environment variable to determine the address of the session bus. Create a sysdep function dbus_lookup_session_address which can be filled in with platform-specific code.
* | Bug 14259 - Work around broken getgrouplist on MacOS XBenjamin Reed2009-07-131-11/+39
| | | | | | | | | | | | | | We don't get the number of groups, so allocate an arbitrary larger array. Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
* | 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 18121 - Use a monotonic clock for pthread timeoutsColin Walters2009-07-101-2/+41
| | | | | | | | | | | | | | | | Patch based on one from Keith Mok <ek9852@gmail.com>, some followup work from Janne Karhunen <Janne.Karhunen@gmail.com>. We don't want condition variable timeouts to be affected by the system clock. Use the POSIX CLOCK_MONOTONIC if available.
* | Ensure messages are locked while marshalling.Will Thompson2009-07-101-0/+15
| | | | | | | | | | | | | | Locking a message has the side-effect of updating the message's length header. Previously, if dbus_message_marshal() was called on an unlocked message, it could yield an invalid message (as discovered by Ben Schwartz in <http://bugs.freedesktop.org/show_bug.cgi?id=19723>).
* | Bug 21161 - Update the FSF addressTobias Mueller2009-07-10129-131/+131
| | | | | | | | | | | | No comment. Signed-off-by: Colin Walters <walters@verbum.org>
* | Bug 21646 - Fix a signed char comparisonColin Walters2009-07-101-4/+7
| | | | | | | | | | | | Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com> Explicitly cast to unsigned char before we do comparisons.
* | Bug 21347 - Don't fail autolaunching if process has SIGCHLD handlerKurt Miller2009-07-101-0/+13
| | | | | | | | | | | | | | | | | | If other code in the process set a global SIGCHLD handler, it will make autolaunching fail spuriously due to waitpid() failing. This fix will temporarily block SIGCHLD delivery. Signed-off-by: Colin Walters <walters@verbum.org>
* | dbus_message_append_args_valist - abandon containerScott James Remnant2009-07-091-2/+6
| | | | | | | | | | | | | | In case of OOM when constructing an array, we should abandon the container to free the resources. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | bfo22316 - add dbus_message_iter_abandon_container()Scott James Remnant2009-07-093-2/+59
| | | | | | | | | | | | | | | | It's not currently possible to abandon creation of a container without either hitting asserts or leaking memory. This new function allows that. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | Add test case for assert when unwinding a container.Scott James Remnant2009-07-091-0/+29
| | | | | | | | | | | | | | | | * dbus/dbus-message-util.c: when constructing an array of structures, it's not possible to unwind in case of an error part-way through. This test will therefore assert. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | Remove 6 hour timeout restriction.Scott James Remnant2009-05-281-7/+0
| | | | | | | | | | | | | | * dbus/dbus-pending-call.c (_dbus_pending_call_new_unlocked): Now that the timeout math won't overflow, don't clamp to six hours. Signed-off-by: Scott James Remnant <scott@ubuntu.com>
* | 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>
* | Don't allocate DBusTimeout for pending call when passed INT_MAXScott James Remnant2009-05-281-19/+24
| | | | | | | | | | | | | | | | | | * dbus/dbus-pending-call.c (_dbus_pending_call_new_unlocked): When passed INT_MAX, do not clamp the value and do not allocate a timeout for the call (_dbus_pending_call_get_timeout_unlocked): Document that this may return NULL. 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>