| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Thiago Macieira <thiago@kde.org>
|
|
|
|
| |
Signed-off-by: Thiago Macieira <thiago@kde.org>
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
dbus/dbus-connection.c
dbus/dbus-message-util.c
dbus/dbus-sysdeps-unix.c
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
in once piece right now
|
| |
| |
| |
| | |
This make all counters count both bytes of memory and unix fds.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
This should fix another CLOEXEC race.
|
| |
| |
| |
| |
| | |
Instead of having everyone define _GNU_SOURCE and similar macros
seperately, simply do so centrally by using AC_USE_SYSTEM_EXTENSIONS
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
This is actually pretty boring since we store our fds as indexes that
are stored as uint32_t's.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
If we can use MSG_NOSIGNAL we don't have to play games with SIGPIPE
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes dbus on FreeBSD and DragonFly systems.
The patch is obtained from FreeBSD ports tree.
Signed-off-by: Colin Walters <walters@verbum.org>
|
| |
| |
| |
| | |
Signed-off-by: Colin Walters <walters@verbum.org>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
We don't get the number of groups, so allocate an arbitrary
larger array.
Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
|
| |
| |
| |
| | |
Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| | |
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>).
|
| |
| |
| |
| |
| |
| | |
No comment.
Signed-off-by: Colin Walters <walters@verbum.org>
|
| |
| |
| |
| |
| |
| | |
Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com>
Explicitly cast to unsigned char before we do comparisons.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
| |
| |
| |
| |
| |
| |
| |
| | |
* 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>
|
|/
|
|
|
|
|
|
|
|
| |
* 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>
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
bus/bus.c
bus/config-parser-common.c
bus/config-parser-common.h
bus/config-parser.c
bus/connection.c
bus/dbus-daemon.1.in
dbus/dbus-marshal-validate-util.c
dbus/dbus-marshal-validate.c
dbus/dbus-sysdeps-util-unix.c
test/name-test/tmp-session-like-system.conf
|