Commit graph

3434 commits

Author SHA1 Message Date
Ralf Habacker
29a27c47e6 Fixed cmake cross compile timestamp creating.
We only need to distinct "Windows" from unix like systems

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-02-12 10:58:27 +00:00
Ralf Habacker
48fb808351 Uses cmake provided expat find package.
The cmake provided expat find package is more up to date.
There is no need to maintain an additional one.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-02-12 10:58:04 +00:00
Krzysztof Konopko
161b7d7007 Merge <servicehelper> from included config file
<servicehelper> is not supported in the included config file, i. e. it's
not merged in merge_included().  There's clearly no reason it shouldn't
be supported in the included config file along with <user>, <type>
and others.  It's quite reasonable for a client willing to override the
default servicehelper, e. g. in system-local.conf.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=51560
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-02-12 10:49:29 +00:00
Colin Walters
325c018c1f build: Dist autogen.sh
For convenience of people who have to patch the autotools.
See also http://people.gnome.org/~walters/docs/build-api.txt

https://bugs.freedesktop.org/show_bug.cgi?id=60330
2013-02-05 12:50:55 -05:00
Ralf Habacker
1e1e4c92ac CMake build system fix: Lets check for xmlto doc book generator first.
We shouldn't try to build the documentation with meinproc *and* xmlto.
Prefer xmlto, since it's also the one we use under Autotools.
We still need to support meinproc as a fallback, because xmlto isn't
available on Windows.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-01-29 20:02:10 +01:00
Ralf Habacker
3a600899d4 Fixed cmake warning related to WIN32 macro when configuring on cygwin
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59401
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-01-15 13:33:03 +01:00
Ralf Habacker
fccb9560b3 Create missing directories in cmake <build-root>/bus/session.d and <build-root>/bus/system.d
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41319
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-01-15 09:32:14 +01:00
Simon McVittie
d8e3f0d5a6 NEWS
As well as documenting recent changes, this sorts out some divergence
between the master and dbus-1.6 versions of NEWS, so the 1.6 entries
are the same as in the corresponding releases.
2012-11-19 15:21:57 +00:00
Simon McVittie
0b7ab6cf1c dbus-sysdeps-pthread.c: don't fail if !HAVE_MONOTONIC_CLOCK under -Werror=unused
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=47239
2012-11-19 15:14:17 +00:00
Simon McVittie
277675a40e configure: redo pthread check to check for more things
In principle, anything in the pthread namespace might either be in the
platform-specific thread library (libpthread or libpthreads or libthreads
or ...), or in libc.

In particular, it seems that pthread_mutexattr_init and
pthread_mutexattr_settype are in libpthread, not libc, on Linux. We
previously didn't (intentionally) look for them in libpthread, only
in libc; so this check deserved to fail.

However, a faulty configure check for pthread_cond_timedwait
worked around this on Linux by checking for -lpthread and adding it
to THREAD_LIBS if pthread_cond_timedwait *was* found in libc (even
though that behaviour makes no sense).

The practical impact was that D-Bus would fail to compile on platforms
where pthread_cond_timedwait is in a special threading library that
is not linked by default, and at least one of
(pthread_mutexattr_init, pthread_mutexattr_settype) is also in a
special threading library. This is the case on at least OpenBSD
(fd.o #54416).

So far I've only added checks for the new symbols introduced by
using recursive pthreads mutexes. If we get reports of compilation
failures on weird platforms, we can check for more symbols.

Also clarify the indentation, which was turning into quite a mess,
and use AS_IF instead of if/elif/else/fi in accordance with Autoconf
best-practice.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=47239
Reviewed-by: Colin Walters <walters@verbum.org>
2012-11-19 15:13:42 +00:00
Simon McVittie
16d0564f30 Don't include generated documentation in the tarball
Building it unconditionally causes problems for minimal installations
(OSTree), and building it opportunistically means the tarball isn't
guaranteed to contain it, depending who releases libdbus and which
packages they happen to have installed at the time. If this documentation
is important enough that we need to ship it precompiled in tarballs,
we should guarantee it; or if it isn't important enough to justify that,
we should just drop it.

I don't think we really need it in the tarballs at all: most users
will get their libdbus from a binary distribution (in which case I expect
the distribution's dbus maintainers to set appropriate
build-dependencies), and those who build from source can either
install xmlto, read the documentation on our website, or at worst,
read the source XML. (We don't put the Doxygen-generated API reference
HTML in the tarball either, and I haven't heard any complaints.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55426
Reviewed-by: Colin Walters <walters@verbum.org>
2012-11-13 16:13:26 +00:00
Michel HERMIER
b8b3feb986 Remove redundant close() calls
The dup2() calls immediately afterwards will close the "destination" fd
if necessary.

[commit message added -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-11-09 16:07:53 +00:00
Simon McVittie
5847982adb Merge branch 'dbus-1.6'
Conflicts:
	NEWS
2012-11-09 16:07:44 +00:00
Simon McVittie
9b04b927ee NEWS 2012-11-09 16:02:53 +00:00
Michel HERMIER
9a9b0e2736 Don't leak temporary fds pointing to /dev/null
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=56927
[commit message added -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-11-09 16:02:01 +00:00
Simon McVittie
1e494ecc60 Use InterlockedExchange to get a full memory barrier on Windows
See the bug for extensive discussion.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41423
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2012-11-09 15:31:30 +00:00
Simon McVittie
96cb1542c2 include README.valgrind in tarballs 2012-11-09 15:28:16 +00:00
Arun Raghavan
ad6e1b0420 Add documentation on running clients with Valgrind
Quick documentation on how Valgrind can be run in clients without
triggering false positives.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55933
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-11-09 15:27:27 +00:00
Colin Walters
d9f470a7f4 build: Ensure docs are enabled for distcheck
https://bugs.freedesktop.org/show_bug.cgi?id=55426

Signed-off-by: Colin Walters <walters@verbum.org>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-11-09 14:06:29 +00:00
Arun Raghavan
e516a31f59 Fix building with newer Valgrind
Newer valgrind (tried with 3.8.0) defines macros so that a terminating
semi-colon is required. This fixes usage to follow that convention.

[edited to remove comments that are no longer useful -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55932
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2012-11-09 14:04:27 +00:00
Pavel Strashkin
847c542374 spec: fix command name REJECT -> REJECTED
Signed-off-by: Pavel Strashkin <pavel.strashkin@nexenta.com>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-11-02 09:42:51 -04:00
Ray Strode
4bec2c72e8 dbus-spawn: fix spacing mistake in comment
commit 90f939f155 had two problems.

1) a small whitespace error in the added comment
2) the wrong bug reference at the bottom

I'm using 1) as an excuse to add additional commit for the sake
of 2).

https://bugs.freedesktop.org/show_bug.cgi?id=56043
2012-10-16 15:29:27 -04:00
Ray Strode
90f939f155 dbus-spawn: set SIGPIPE to SIG_IGN before activating services
dbus's service activation code sets SIGPIPE to SIG_DFL as a
sort of poor man's prctl(... PR_SET_PDEATHSIG) to detect when
the parent goes away.

It neglects to reignore the infamous signal before performing
activation, however.

This means if, for instance, journald is restarted all
services activated after it will die with SIGPIPE when logging
messages unless they explicitly ignore SIGPIPE themselves.

This commit changes dbus's service activation code to correctly
ignore SIGPIPE to protect activated services from a gruesome,
premature death.

Reviewed-by: Lennart Poettering <lennart@poettering.net>

https://bugzilla.redhat.com/show_bug.cgi?id=839258
2012-10-16 14:44:55 -04:00
Simon Peeters
d728fdc655 Set correct address when using --address=systemd:
When dbus gets launched through systemd, we need to create an address
string based on the sockets passed.

The _dbus_append_addres_from_socket() function is responsible for
extracting the address information from the file-descriptor and
formatting it in a dbus friendly way.

This fixes bus activation when running dbus under a systemd session.

https://bugs.freedesktop.org/show_bug.cgi?id=50962

Signed-off-by: Simon Peeters <peeters.simon@gmail.com>
2012-10-08 16:58:10 -04:00
Simon McVittie
778e2a5a91 Merge remote-tracking branch 'origin/master' 2012-10-04 08:55:49 +01:00
Simon McVittie
9fafead23d Merge branch 'dbus-1.6'
Conflicts:
	NEWS
	bus/activation-helper.c
	configure.ac
2012-10-04 08:54:58 +01:00
Simon McVittie
62aec8838a activation helper: when compiled for tests, do not reset system bus address
Otherwise, the tests try to connect to the real system bus, which will
often fail - particularly if you run the tests configured for the default
/usr/local (with no intention of installing the result), in which case
the tests would try to connect to /usr/local/var/run/dbus/system_bus_socket.

Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-10-04 08:17:27 +01:00
Colin Walters
e296f5c824 build: Make --disable-xml-docs build work again
We can't build the .html files without xmlto, so don't add them
to a dist_ variable.

https://bugs.freedesktop.org/show_bug.cgi?id=55426
2012-10-02 08:41:44 -04:00
Simon McVittie
40cc5ebd4a Post-release version bump 2012-10-02 09:47:20 +01:00
Colin Walters
c7495461fe Revert "hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()"
Follow to reverting a556443757b19fee67ef4441141246dd9cfed4f.
See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c24

This reverts commit d7ffad7214.
2012-09-28 16:16:34 -04:00
Colin Walters
19fa7c547f Revert "hardening: Use __secure_getenv if available"
It breaks gnome-keyring-daemon at least in some
configurations; see
https://bugs.freedesktop.org/show_bug.cgi?id=52202#c24

This reverts commit 1a55644375.
2012-09-28 16:16:33 -04:00
Colin Walters
1cad15cc27 Release 1.6.8 2012-09-28 15:44:59 -04:00
Colin Walters
fb8b8ce72c Revert "hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()"
Follow to reverting a556443757b19fee67ef4441141246dd9cfed4f.
See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c24

This reverts commit d7ffad7214.
2012-09-28 15:31:47 -04:00
Colin Walters
dcee0dd7c0 Revert "hardening: Use __secure_getenv if available"
It breaks gnome-keyring-daemon at least in some
configurations; see
https://bugs.freedesktop.org/show_bug.cgi?id=52202#c24

This reverts commit 1a55644375.
2012-09-28 15:31:05 -04:00
Colin Walters
819eb8a9f5 Resume development 2012-09-28 13:20:14 -04:00
Colin Walters
cf13cd08c7 Release 1.6.6 2012-09-28 13:08:42 -04:00
Geoffrey Thomas
fc4547fe08 activation-helper: Ensure DBUS_STARTER_ADDRESS is set correctly
The fix for CVE-2012-3524 filters out all environment variables if
libdbus is used from a setuid program, to prevent various spoofing
attacks.

Unfortunately, the activation helper is a setuid program linking
libdbus, and this creates a regression for launched programs using
DBUS_STARTER_ADDRESS, since it will no longer exist.

Fix this by hardcoding the starter address to the default system bus
address.

Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-09-28 12:55:38 -04:00
Colin Walters
9a0c289be6 hardening: Remove activation helper handling for DBUS_VERBOSE
It's not really useful.

See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17
2012-09-28 12:55:38 -04:00
Colin Walters
d7ffad7214 hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()
This is a further security measure for the case of Linux/glibc
when we're linked into a binary that's using filesystem capabilities
or SELinux domain transitions (i.e. not plain old setuid).

In this case, _dbus_getenv () will return NULL because it will
use __secure_getenv(), which handles those via AT_SECURE.

https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-09-28 12:55:38 -04:00
Colin Walters
c27c500413 hardening: Ensure _dbus_check_setuid() is initialized threadsafe manner
This is a highly theoretical concern, but we might as well.

https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-09-28 12:55:38 -04:00
Colin Walters
1a55644375 hardening: Use __secure_getenv if available
This helps us in the case where we were executed via filesystem
capabilities or a SELinux domain transition, not necessarily a plain
old setuid binary.

https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-09-28 12:55:38 -04:00
Colin Walters
a52319bc29 CVE-2012-3524: Don't access environment variables or run dbus-launch when setuid
This matches a corresponding change in GLib.  See
glib/gutils.c:g_check_setuid().

Some programs attempt to use libdbus when setuid; notably the X.org
server is shipped in such a configuration. libdbus never had an
explicit policy about its use in setuid programs.

I'm not sure whether we should advertise such support.  However, given
that there are real-world programs that do this currently, we can make
them safer with not too much effort.

Better to fix a problem caused by an interaction between two
components in *both* places if possible.

How to determine whether or not we're running in a privilege-escalated
path is operating system specific.  Note that GTK+'s code to check
euid versus uid worked historically on Unix, more modern systems have
filesystem capabilities and SELinux domain transitions, neither of
which are captured by the uid comparison.

On Linux/glibc, the way this works is that the kernel sets an
AT_SECURE flag in the ELF auxiliary vector, and glibc looks for it on
startup.  If found, then glibc sets a public-but-undocumented
__libc_enable_secure variable which we can use.  Unfortunately, while
it *previously* worked to check this variable, a combination of newer
binutils and RPM break it:
http://www.openwall.com/lists/owl-dev/2012/08/14/1

So for now on Linux/glibc, we fall back to the historical Unix version
until we get glibc fixed.

On some BSD variants, there is a issetugid() function.  On other Unix
variants, we fall back to what GTK+ has been doing.

Reported-by: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-09-28 12:55:38 -04:00
Geoffrey Thomas
f68dbdc3e6 activation-helper: Ensure DBUS_STARTER_ADDRESS is set correctly
The fix for CVE-2012-3524 filters out all environment variables if
libdbus is used from a setuid program, to prevent various spoofing
attacks.

Unfortunately, the activation helper is a setuid program linking
libdbus, and this creates a regression for launched programs using
DBUS_STARTER_ADDRESS, since it will no longer exist.

Fix this by hardcoding the starter address to the default system bus
address.

Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-09-28 12:08:28 -04:00
Colin Walters
57ae367050 hardening: Remove activation helper handling for DBUS_VERBOSE
It's not really useful.

See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17
2012-09-28 12:01:56 -04:00
Colin Walters
d4379ee8db hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()
This is a further security measure for the case of Linux/glibc
when we're linked into a binary that's using filesystem capabilities
or SELinux domain transitions (i.e. not plain old setuid).

In this case, _dbus_getenv () will return NULL because it will
use __secure_getenv(), which handles those via AT_SECURE.

https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-09-28 10:18:15 -04:00
Colin Walters
4b351918b9 hardening: Ensure _dbus_check_setuid() is initialized threadsafe manner
This is a highly theoretical concern, but we might as well.

https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-09-28 10:18:15 -04:00
Colin Walters
d839f027ed hardening: Use __secure_getenv if available
This helps us in the case where we were executed via filesystem
capabilities or a SELinux domain transition, not necessarily a plain
old setuid binary.

https://bugs.freedesktop.org/show_bug.cgi?id=52202
2012-09-28 10:18:15 -04:00
Colin Walters
23fe78ceef CVE-2012-3524: Don't access environment variables or run dbus-launch when setuid
This matches a corresponding change in GLib.  See
glib/gutils.c:g_check_setuid().

Some programs attempt to use libdbus when setuid; notably the X.org
server is shipped in such a configuration. libdbus never had an
explicit policy about its use in setuid programs.

I'm not sure whether we should advertise such support.  However, given
that there are real-world programs that do this currently, we can make
them safer with not too much effort.

Better to fix a problem caused by an interaction between two
components in *both* places if possible.

How to determine whether or not we're running in a privilege-escalated
path is operating system specific.  Note that GTK+'s code to check
euid versus uid worked historically on Unix, more modern systems have
filesystem capabilities and SELinux domain transitions, neither of
which are captured by the uid comparison.

On Linux/glibc, the way this works is that the kernel sets an
AT_SECURE flag in the ELF auxiliary vector, and glibc looks for it on
startup.  If found, then glibc sets a public-but-undocumented
__libc_enable_secure variable which we can use.  Unfortunately, while
it *previously* worked to check this variable, a combination of newer
binutils and RPM break it:
http://www.openwall.com/lists/owl-dev/2012/08/14/1

So for now on Linux/glibc, we fall back to the historical Unix version
until we get glibc fixed.

On some BSD variants, there is a issetugid() function.  On other Unix
variants, we fall back to what GTK+ has been doing.

Reported-by: Sebastian Krahmer <krahmer@suse.de>
Signed-off-by: Colin Walters <walters@verbum.org>
2012-09-27 21:10:28 -04:00
Simon McVittie
4d0a69027e Merge branch 'dbus-1.6' 2012-09-03 10:20:01 +01:00
Simon McVittie
6dcef0c8f0 NEWS 2012-09-03 10:19:29 +01:00