Commit graph

1997 commits

Author SHA1 Message Date
Colin Walters
70c5285eb4 Cope with dbus-launch not being in DBUS_BINDIR
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.
2009-07-14 11:43:54 -04:00
Hasso Tepper
7bf132c7d1 Bug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)
Fixes dbus on FreeBSD and DragonFly systems.

The patch is obtained from FreeBSD ports tree.

Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-13 14:26:05 -04:00
Daniel Reed
e4b271e242 Bug 2432 - Support --address option for dbus-monitor
Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-13 14:06:41 -04:00
Grzegorz Dąbrowski
97c58ace43 Bug 19446 - HaikuOS support
Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-13 13:53:38 -04:00
Paul Bolle
249f89181c Bug 16688 - typo in dbus-monitor.1
s/dbus_bus_add_watch/dbus_bus_add_match/

Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-13 13:35:48 -04:00
Colin Walters
f908daed82 Bug 22415 - COYPING file should note we allow later versions of GPL
The canonical copyright information in the source file says we
allow later versions of the GPL.  So note that in COPYING too.
2009-07-13 13:11:20 -04:00
Colin Walters
0e36cdd549 Bug 896 - Avoid race conditions reading message from exited process
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.
2009-07-13 13:07:12 -04:00
Colin Walters
6b163e95e7 Bug 14259 - Refactor _dbus_get_autolaunch_address
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.
2009-07-13 13:02:21 -04:00
Colin Walters
6478ec6949 Bug 14259 - Make session address lookup system-dependent
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.
2009-07-13 12:47:19 -04:00
Benjamin Reed
c71403ddde Bug 14259 - Work around broken getgrouplist on MacOS X
We don't get the number of groups, so allocate an arbitrary
larger array.

Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
2009-07-13 11:21:08 -04:00
Kimmo Hämäläinen
ccfa8e5154 Bug 12484 - Ensure initialized variable in dbus_connection_remove_filter
Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
2009-07-13 06:31:35 -04:00
Colin Walters
ae24bb35e2 Bug 18121 - Use a monotonic clock for pthread timeouts
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.
2009-07-10 22:57:08 -04:00
Matthias Clasen
f4e15893e5 Bug 22516 - Ensure inotify fd is set close on exec
This prevents it leaking into spawned child processes.

Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-10 20:11:22 -04:00
Colin Walters
98bbe8c794 Bug 21545 - Move CFLAGS modification towards the end of configure
This prevents the flags from screwing up autoconf tests.
2009-07-10 20:07:34 -04:00
Will Thompson
9f825271f9 Ensure messages are locked while marshalling.
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>).
2009-07-10 19:43:37 -04:00
Christian Persch (GNOME)
fe86222d10 Bug 21657 - Fix configure checks for va_list in maintainer mode
Include the right headers.
2009-07-10 19:40:00 -04:00
Tobias Mueller
5baf2f856a Bug 21161 - Update the FSF address
No comment.

Signed-off-by: Colin Walters <walters@verbum.org>
2009-07-10 19:32:38 -04:00
Colin Walters
1f6ac4deef Bug 21646 - Fix a signed char comparison
Original suggested patch from Marc-Andre Lureau <marcandre.lureau@gmail.com>

Explicitly cast to unsigned char before we do comparisons.
2009-07-10 19:26:52 -04:00
Colin Walters
e5310abd6c Add missing include for unistd.h in test-service.c
We use usleep here.
2009-07-10 19:22:54 -04:00
Kurt Miller
644fc38b24 Bug 21347 - Don't fail autolaunching if process has SIGCHLD handler
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>
2009-07-10 19:19:28 -04:00
Scott James Remnant
3f07008823 dbus_message_append_args_valist - abandon container
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>
2009-07-09 16:35:13 +01:00
Scott James Remnant
e57a368c44 bfo22316 - add dbus_message_iter_abandon_container()
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>
2009-07-09 16:34:54 +01:00
Scott James Remnant
4bea3ca2b0 Add test case for assert when unwinding a container.
* 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>
2009-07-09 16:28:29 +01:00
Scott James Remnant
0ee5d8e155 Bump configure.in for GIT
Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-07-09 16:23:43 +01:00
Scott James Remnant
c1f165261a Add tests for pending call timeouts
* test/test-service.c (handle_delay_echo, path_message_func): Add a
  variant of the Echo method which sleeps for a short time.
* test/name-test/test-pending-call-timeout.c: Run tests with default,
  specified and infinite timeout to make sure we get the reply.
* test/name-test/run-test.sh: Run the new test
* test/name-test/Makefile.am: Build the new test

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-05-28 11:47:38 +02:00
Scott James Remnant
bd2063e17e Unrestrict session bus timeout.
* bus/session.conf.in: Remove the reply_timeout stanza, previously
  intended to increase the reply timeout, this now reduces it.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-05-28 11:47:37 +02:00
Scott James Remnant
8f1d2a2fa8 Change default reply timeout.
* bus/config-parser.c (bus_config_parser_new): change the default reply
  timeout to "never"

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-05-28 11:47:36 +02:00
Scott James Remnant
d672d03206 Expire list timeout may be negative for no expiry.
* bus/expirelist.c (do_expiration_with_current_time): Don't check for
  expiry if expire_after is negative, will just disable the expiry timer
  after the call.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-05-28 11:47:35 +02:00
Scott James Remnant
d33cfec625 Explicitly check for zero time fields.
* bus/expirelist.c (do_expiration_with_current_time): If the item added
  time fields are both zero, always expire.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-05-28 11:47:35 +02:00
Scott James Remnant
7398ad7374 Remove 6 hour timeout restriction.
* 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>
2009-05-28 11:47:34 +02:00
Scott James Remnant
1faa92114f Fix issue where timeouts can overflow.
* 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>
2009-05-28 11:47:33 +02:00
Scott James Remnant
ce0d932d9b Update documentation now that INT_MAX means no timeout.
* 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>
2009-05-28 11:47:32 +02:00
Scott James Remnant
92dd55c903 Don't allocate DBusTimeout for pending call when passed INT_MAX
* 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>
2009-05-28 11:47:31 +02:00
Scott James Remnant
e5eb472d11 Allow a pending call to block forever
* 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>
2009-05-28 11:47:30 +02:00
Scott James Remnant
ba22606c3b Make sure a pending call timeout isn't assumed.
* 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>
2009-05-28 11:47:21 +02:00
Thiago Macieira
f322112b84 Merge branch 'dbus-1.2' 2009-05-13 15:52:26 +02:00
Thiago Macieira
e21d06cba4 Merge branch 'dbus-1.2'
Conflicts:
	dbus/dbus-sysdeps-util-unix.c
2009-05-13 15:52:18 +02:00
Marc Mutz
6eddb6e122 configure.in: fail abstract socket test gracefully when cross-compiling
* configure.in: only run AC_CACHE_CHECK if enable_abstract_sockets=auto
 * configure.in: warn that, when cross-compiling, we're unable to detect
                 abstract sockets availability automatically

Signed-off-by: Thiago Macieira <thiago@kde.org>
2009-05-13 15:50:52 +02:00
Marc Mutz
f719d45432 configure.in: not all gccs support -Wno-pointer-sign
Signed-off-by: Thiago Macieira <thiago@kde.org>
2009-05-13 15:50:51 +02:00
Colin Walters
f76d17437e Release 1.2.14 2009-05-06 12:51:19 -04:00
Eamon Walsh
b38c433bf7 libselinux behavior in permissive mode wrt invalid domains
Stephen Smalley wrote:
> On Tue, 2009-04-21 at 16:32 -0400, Joshua Brindle wrote:
>
>> Stephen Smalley wrote:
>>
>>> On Thu, 2009-04-16 at 20:47 -0400, Eamon Walsh wrote:
>>>
>>>> Stephen Smalley wrote:
>>>>
>> <snip>
>>
>>
>>> No, I don't want to change the behavior upon context_to_sid calls in
>>> general, as we otherwise lose all context validity checking in
>>> permissive mode.
>>>
>>> I think I'd rather change compute_sid behavior to preclude the situation
>>> from arising in the first place, possibly altering the behavior in
>>> permissive mode upon an invalid context to fall back on the ssid
>>> (process) or the tsid (object).  But I'm not entirely convinced any
>>> change is required here.
>>>
>>>
>> I just want to follow up to make sure we are all on the same page here. Was the
>> suggestion to change avc_has_perm in libselinux or context_to_sid in the kernel
>> or leave the code as is and fix the callers of avc_has_perm to correctly handle
>> error codes?
>>
>> I prefer the last approach because of Eamon's explanation, EINVAL is already
>> passed in errno to specify the context was invalid (and if object managers
>> aren't handling that correctly now there is a good chance they aren't handling
>> the ENOMEM case either).
>>
>
> I'd be inclined to change compute_sid (not context_to_sid) in the kernel
> to prevent invalid contexts from being formed even in permissive mode
> (scenario is a type transition where role is not authorized for the new
> type).  That was originally to allow the system to boot in permissive
> mode.  But an alternative would be to just stay in the caller's context
> (ssid) in that situation.
>
> Changing the callers of avc_has_perm() to handle EINVAL and/or ENOMEM
> may make sense, but that logic should not depend on enforcing vs.
> permissive mode.
>
>

FWIW, the following patch to D-Bus should help:

bfo21072 - Log SELinux denials better by checking errno for the cause

    Note that this does not fully address the bug report since
    EINVAL can still be returned in permissive mode.  However the log
    messages will now reflect the proper cause of the denial.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Colin Walters <walters@verbum.org>
2009-05-06 12:51:19 -04:00
Federico Mena Quintero
73ec6964d7 bfo20738 - Return a useful error message from dbus_signature_validate()
Signed-off-by: Federico Mena Quintero <federico@novell.com>
2009-05-06 12:51:18 -04:00
Federico Mena Quintero
0f19140b52 bfo20738 - Translate DBusValidity into error message
Signed-off-by: Federico Mena Quintero <federico@novell.com>
2009-05-06 12:51:18 -04:00
William Lachance
0cf4583b5a Bug 19567 - Make marshaling code usable without DBusConnection
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>
2009-05-06 12:51:18 -04:00
Colin Walters
86df8ad592 Followup Bug 19502 - Don't attempt to init va_list, not portable 2009-05-06 12:51:18 -04:00
Kjartan Maraas
eb3b99e7c6 Bug 19502 - Sparse warning cleanups
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>
2009-05-06 12:51:18 -04:00
Eamon Walsh
da75989b39 dbus-launch: use InputOnly X window
Working on SELinux policy for X, and came across this issue in dbus-launch:

Windows created for use as property/selection placeholders should be of
class InputOnly, since no drawing is ever done to them.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Thiago Macieira <thiago@kde.org>
2009-05-06 12:51:17 -04:00
Johan Gyllenspetz
5b4ee5fb40 Bug 20494 - Fix signed confusion for dbus_message_get_reply_serial return
We were incorrectly converting the serial to a signed integer
and comparing it to -1.

Signed-off-by: Colin Walters <walters@verbum.org>
2009-05-06 12:51:17 -04:00
Colin Walters
15f5183016 Bug 20137 - Fix alignment usage when demarshaling basics
We can't safely type-pun from e.g. char * to DBusBasicValue *, because
the latter has higher alignment requirements.  Instead, create an
explicit pointer for each case.

Also, we mark each one volatile to sidestep strict aliasing issues, for
the future when we turn on strict aliasing support.

Original patch and review from Jay Estabrook <jay.estabrook@hp.com>.
2009-05-06 12:51:17 -04:00
Colin Walters
a709566edd Always append closing quote in log command
Patch suggested by Tomas Hoger <thoger@redhat.com>
2009-05-06 12:51:17 -04:00