platform/upstream/dbus.git
11 years agocmake: define default_message_unix_fds so it can be substituted in session.conf
Simon McVittie [Thu, 18 Apr 2013 11:21:58 +0000 (12:21 +0100)]
cmake: define default_message_unix_fds so it can be substituted in session.conf

This fixes a regression since 1.7.0: session.conf would be invalid when
generated by cmake.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63682
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
11 years agosd-daemon.c: update from systemd for better portability
Simon McVittie [Tue, 16 Apr 2013 16:40:41 +0000 (17:40 +0100)]
sd-daemon.c: update from systemd for better portability

11 years agoNEWS for 1.7
Simon McVittie [Thu, 11 Apr 2013 13:00:15 +0000 (14:00 +0100)]
NEWS for 1.7

11 years agoSet default maximum number of Unix fds according to OS
Matt Fischer [Wed, 20 Feb 2013 21:23:42 +0000 (15:23 -0600)]
Set default maximum number of Unix fds according to OS

QNX has an arbitrary limit to the number of file descriptors
which may be passed in a message, which is smaller than the
current default.  This patch therefore changes the default from
a hardcoded constant to a macro, which is determined at configure
time by looking at the host operating system.

[This reduces the limit from 4096 (session)/1024 (system) to 128 fds
per message on QNX, and 1024 fds per message on other operating systems.
I think the reduced session bus limit on other OSs is a reasonable change
too, given that the default hard/soft ulimits in Linux are only 4096/1024
fds per process. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176
Reviewed-by: Simon McVittie <simon.mcvittie.collabora.co.uk>
11 years agoDo not suppress syslog test's stderr just because init is systemd
Simon McVittie [Fri, 5 Apr 2013 12:28:54 +0000 (13:28 +0100)]
Do not suppress syslog test's stderr just because init is systemd

This causes the test to fail. The assumption implicitly being made was
"if pid 1 is systemd, then every caller of _dbus_init_system_log() is a
systemd service" which is not valid for the regression test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63163
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
11 years agofix NEWS: a Windows "sid" is a security ID, not a session ID
Simon McVittie [Fri, 5 Apr 2013 16:01:29 +0000 (17:01 +0100)]
fix NEWS: a Windows "sid" is a security ID, not a session ID

11 years agoMerge branch 'dbus-1.6'
Simon McVittie [Fri, 5 Apr 2013 12:00:22 +0000 (13:00 +0100)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS
configure.ac

11 years agoNEWS for 1.7
Simon McVittie [Fri, 5 Apr 2013 11:57:56 +0000 (12:57 +0100)]
NEWS for 1.7

11 years agoAllow use of GLib 2.32 functionality, which we do conditionally
Simon McVittie [Fri, 5 Apr 2013 11:54:57 +0000 (12:54 +0100)]
Allow use of GLib 2.32 functionality, which we do conditionally

11 years agoDon't warn for functions deprecated since GLib 2.26
Simon McVittie [Mon, 18 Feb 2013 14:27:48 +0000 (14:27 +0000)]
Don't warn for functions deprecated since GLib 2.26

Also warn if we inadvertently use a function introduced since then.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59971
Reviewed-by: Colin Walters <walters@verbum.org>
11 years agoNEWS for 1.6
Simon McVittie [Fri, 5 Apr 2013 11:47:07 +0000 (12:47 +0100)]
NEWS for 1.6

11 years agoDon't access random memory if data slot isn't allocated yet
Dan Williams [Thu, 4 Apr 2013 15:49:18 +0000 (10:49 -0500)]
Don't access random memory if data slot isn't allocated yet

If DBUS_DISABLE_ASSERTS was turned on, and a buggy program called
dbus_connection_get_data() with a slot number less than zero (eg,
before even allocating the data slot), random memory would be
accessed and a random value returned.  Anything less than zero
is not a valid slot number and should be rejected by libdbus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63127
Signed-off-by: Dan Williams <dcbw@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoAdd function _dbus_get_peer_pid_from_tcp_handle() which returns pid and sid from...
Ralf Habacker [Fri, 8 Mar 2013 12:55:32 +0000 (13:55 +0100)]
Add function _dbus_get_peer_pid_from_tcp_handle() which returns pid and sid from tcp connection peer.

This function is called by _dbus_read_credentials_socket() to fetch client credentials.

Because Wine is used to check cross compiled dbus for windows, in calls to GetExtendedTcpTable()
we use table class TCP_TABLE_OWNER_PID_ALL instead of TCP_TABLE_OWNER_PID_CONNECTIONS.
This class is the only one which is available since wine 1.5.3.

https://bugs.freedesktop.org/show_bug.cgi?id=61787
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoMerge branch 'dbus-1.6'
Simon McVittie [Wed, 3 Apr 2013 11:22:24 +0000 (12:22 +0100)]
Merge branch 'dbus-1.6'

11 years agoNEWS for 1.6
Simon McVittie [Wed, 3 Apr 2013 11:20:57 +0000 (12:20 +0100)]
NEWS for 1.6

11 years agoIf alloca.h is available it is required (e.g. on Solaris 10)
Dagobert Michelsen [Wed, 3 Apr 2013 08:38:51 +0000 (10:38 +0200)]
If alloca.h is available it is required (e.g. on Solaris 10)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63071
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoHAVE_DECL_LOG_PERROR is 0 when unavailable
Dagobert Michelsen [Wed, 3 Apr 2013 10:38:38 +0000 (12:38 +0200)]
HAVE_DECL_LOG_PERROR is 0 when unavailable

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39987
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoUpdate sd-daemon.[hc] from upstream
Martin Pitt [Thu, 21 Mar 2013 08:37:48 +0000 (09:37 +0100)]
Update sd-daemon.[hc] from upstream

This fixes sd_booted() to actually mean "have systemd init", which we need for
_dbus_init_system_log() to decide whether systemd journal is being used.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62585
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoFix test for logind availability
Martin Pitt [Thu, 21 Mar 2013 08:24:21 +0000 (09:24 +0100)]
Fix test for logind availability

sd_booted() is not an appropriate check for whether we should talk to logind,
test for /run/systemd/seats/ instead.

For details, see:
<https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00092.html>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62585
[trivial whitespace fix -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoRename the term 'unix_pid' to 'pid' in variables and functions.
Ralf Habacker [Fri, 8 Mar 2013 12:15:36 +0000 (13:15 +0100)]
Rename the term 'unix_pid' to 'pid' in variables and functions.

Windows also has numeric process IDs that fit in an unsigned long, so
there's no reason this has to be Unix-specific.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61787
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoDo not retrieve credential information from the wrong side of the connection.
Ralf Habacker [Fri, 8 Mar 2013 09:44:30 +0000 (10:44 +0100)]
Do not retrieve credential information from the wrong side of the connection.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61787
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoDebug message eol fix.
Ralf Habacker [Thu, 7 Mar 2013 09:42:26 +0000 (10:42 +0100)]
Debug message eol fix.

11 years agoCMake linux fixes when using meinproc4 doc generator.
Ralf Habacker [Thu, 28 Feb 2013 12:22:33 +0000 (12:22 +0000)]
CMake linux fixes when using meinproc4 doc generator.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61637
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoFix cmake linux build: dbus-1 and dbus-internal require to link to rt library
Ralf Habacker [Mon, 4 Mar 2013 14:24:19 +0000 (15:24 +0100)]
Fix cmake linux build: dbus-1 and dbus-internal require to link to rt library

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61637
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agobus driver: factor out common code to get a named connection
Simon McVittie [Wed, 28 Nov 2012 12:01:37 +0000 (12:01 +0000)]
bus driver: factor out common code to get a named connection

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445
Reviewed-by: Thiago Macieira <thiago@kde.org>
11 years agoinclude sd-daemon.h for sd_booted()
Simon McVittie [Wed, 27 Feb 2013 19:32:15 +0000 (19:32 +0000)]
include sd-daemon.h for sd_booted()

11 years agosysdeps: Don't use LOG_PERROR if systemd is booted
Colin Walters [Sun, 24 Feb 2013 13:46:48 +0000 (08:46 -0500)]
sysdeps: Don't use LOG_PERROR if systemd is booted

Otherwise we get duplicated log output, since stdout/stderr are
connected to the journal by default.

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

11 years agobump version to 1.7.1
Simon McVittie [Fri, 22 Feb 2013 21:01:07 +0000 (21:01 +0000)]
bump version to 1.7.1

11 years agoPrepare release 1.7.0 (and specification 0.20) dbus-1.7.0
Simon McVittie [Fri, 22 Feb 2013 14:47:07 +0000 (14:47 +0000)]
Prepare release 1.7.0 (and specification 0.20)

11 years agoInclude config.h as the first thing in every .c file
Simon McVittie [Mon, 18 Feb 2013 14:30:22 +0000 (14:30 +0000)]
Include config.h as the first thing in every .c file

...except for CheckForAbstractSockets.c, which runs before config.h is
generated, and sd-daemon.c, which is externally-maintained.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59971
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
11 years agoDon't warn for functions deprecated since GLib 2.26
Simon McVittie [Mon, 18 Feb 2013 14:27:48 +0000 (14:27 +0000)]
Don't warn for functions deprecated since GLib 2.26

Also warn if we inadvertently use a function introduced since then.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59971
Reviewed-by: Colin Walters <walters@verbum.org>
11 years agoAdd support for systems without syslog.h
Matt Fischer [Wed, 20 Feb 2013 21:27:20 +0000 (15:27 -0600)]
Add support for systems without syslog.h

This patch disables the use of syslog for systems which
do not have it, such as QNX.  Log messages are still
printed to stderr.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoFix inotify usage for QNX
Matt Fischer [Tue, 5 Feb 2013 00:30:14 +0000 (18:30 -0600)]
Fix inotify usage for QNX

QNX's copy of sys/inotify.h is broken, and doesn't include
stdint.h even though it refers to types from it.  Therefore,
it must be included manually.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoNEWS
Simon McVittie [Mon, 18 Feb 2013 14:22:09 +0000 (14:22 +0000)]
NEWS

11 years agoEliminate unwanted whitespace from the man pages' XML source
Simon McVittie [Thu, 14 Feb 2013 13:30:19 +0000 (13:30 +0000)]
Eliminate unwanted whitespace from the man pages' XML source

As demanded by the git commit hook set up by autogen.sh, this eliminates
trailing whitespace on each line, and blank lines at EOF. We might as
well do this now, since every line in these files has changed anyway.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
11 years agoRemove doclifter "signature" from Docbook man pages' source
Simon McVittie [Thu, 14 Feb 2013 13:39:15 +0000 (13:39 +0000)]
Remove doclifter "signature" from Docbook man pages' source

This no longer serves any purpose, and might mislead contributors
into thinking that this XML is not the source for the man pages.
(The man(7)-formatted man pages used to be the canonical source for
the XML, but now it's the other way round.)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
11 years agoRemoved precarious cross compile shell script.
Ralf Habacker [Sat, 16 Feb 2013 10:06:43 +0000 (11:06 +0100)]
Removed precarious cross compile shell script.

CMake provides a standardized way to cross compile packages by
using -DCMAKE_TOOLCHAIN_FILE at configure time.

Also recent distributions like opensuse provides up to date native mingw
binary packages and cross compile packages which reduces the cross
compile setup to package installation and setup of a cross tool chain file
as documented at http://www.vtk.org/Wiki/CMake_Cross_Compiling.

https://bugs.freedesktop.org/show_bug.cgi?id=59733
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoMore NEWS
Simon McVittie [Thu, 14 Feb 2013 13:49:02 +0000 (13:49 +0000)]
More NEWS

11 years agoAdd @DBUS_VERSION@ to the generated man pages
Simon McVittie [Thu, 14 Feb 2013 13:23:52 +0000 (13:23 +0000)]
Add @DBUS_VERSION@ to the generated man pages

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[split out of previous patch -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoTurn all man pages' source into configure-generated files
Simon McVittie [Thu, 14 Feb 2013 13:26:57 +0000 (13:26 +0000)]
Turn all man pages' source into configure-generated files

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[dropped whitespace changes per Ralf's review -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoUse Docbook XML as the source for all man pages
Simon McVittie [Tue, 12 Feb 2013 16:01:16 +0000 (16:01 +0000)]
Use Docbook XML as the source for all man pages

This means we no longer need man2html, which is nice.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoFill in a manual and source for all man pages
Simon McVittie [Tue, 12 Feb 2013 16:01:56 +0000 (16:01 +0000)]
Fill in a manual and source for all man pages

I only filled in a version for dbus-daemon, whose XML is already
generated by configure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoGenerate man pages from xml docbook sources for cmake buildsystem.
Ralf Habacker [Tue, 5 Feb 2013 02:10:59 +0000 (03:10 +0100)]
Generate man pages from xml docbook sources for cmake buildsystem.

[removed commented line -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoUpdated man docbook xml sources from man page source using doclifter.
Ralf Habacker [Tue, 5 Feb 2013 01:19:28 +0000 (02:19 +0100)]
Updated man docbook xml sources from man page source using doclifter.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoMoved docbook sources used by cmake into doc subdir and adapted cmake build system.
Ralf Habacker [Tue, 5 Feb 2013 00:20:46 +0000 (01:20 +0100)]
Moved docbook sources used by cmake into doc subdir and adapted cmake build system.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoMore NEWS for 1.7
Simon McVittie [Tue, 12 Feb 2013 11:45:26 +0000 (11:45 +0000)]
More NEWS for 1.7

11 years agoMerge branch 'dbus-1.6'
Simon McVittie [Tue, 12 Feb 2013 11:44:29 +0000 (11:44 +0000)]
Merge branch 'dbus-1.6'

11 years agoNEWS for 1.6
Simon McVittie [Tue, 12 Feb 2013 11:44:11 +0000 (11:44 +0000)]
NEWS for 1.6

11 years agoAdd poll constants for QNX
Matt Fischer [Tue, 5 Feb 2013 00:14:31 +0000 (18:14 -0600)]
Add poll constants for QNX

The QNX operating system uses different values for its poll
constants, so they must be added into dbus-sysdeps.h in order
for poll() to work correctly.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=60339
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
11 years agoUpdate sd-daemon.[ch] from systemd
Simon McVittie [Tue, 12 Feb 2013 11:14:55 +0000 (11:14 +0000)]
Update sd-daemon.[ch] from systemd

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

11 years agoFixed cmake cross compile timestamp creating.
Ralf Habacker [Mon, 28 Jan 2013 19:05:34 +0000 (20:05 +0100)]
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>
11 years agoUses cmake provided expat find package.
Ralf Habacker [Tue, 29 Jan 2013 18:52:06 +0000 (19:52 +0100)]
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>
11 years agoMerge <servicehelper> from included config file
Krzysztof Konopko [Fri, 29 Jun 2012 12:40:37 +0000 (13:40 +0100)]
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>
11 years agobuild: Dist autogen.sh
Colin Walters [Tue, 5 Feb 2013 17:22:13 +0000 (12:22 -0500)]
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

11 years agoCMake build system fix: Lets check for xmlto doc book generator first.
Ralf Habacker [Mon, 28 Jan 2013 18:55:10 +0000 (19:55 +0100)]
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>
11 years agoFixed cmake warning related to WIN32 macro when configuring on cygwin
Ralf Habacker [Tue, 15 Jan 2013 09:09:25 +0000 (10:09 +0100)]
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>
11 years agoCreate missing directories in cmake <build-root>/bus/session.d and <build-root>/bus...
Ralf Habacker [Wed, 5 Sep 2012 03:07:20 +0000 (05:07 +0200)]
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>
11 years agoCreate missing directories in cmake <build-root>/bus/session.d and <build-root>/bus...
Ralf Habacker [Wed, 5 Sep 2012 03:07:20 +0000 (05:07 +0200)]
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>
11 years agoNEWS
Simon McVittie [Mon, 19 Nov 2012 15:21:57 +0000 (15:21 +0000)]
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.

11 years agodbus-sysdeps-pthread.c: don't fail if !HAVE_MONOTONIC_CLOCK under -Werror=unused
Simon McVittie [Mon, 13 Aug 2012 18:43:56 +0000 (19:43 +0100)]
dbus-sysdeps-pthread.c: don't fail if !HAVE_MONOTONIC_CLOCK under -Werror=unused

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

11 years agoconfigure: redo pthread check to check for more things
Simon McVittie [Mon, 13 Aug 2012 18:43:12 +0000 (19:43 +0100)]
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>
11 years agoDon't include generated documentation in the tarball
Simon McVittie [Fri, 9 Nov 2012 14:24:26 +0000 (14:24 +0000)]
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>
11 years agoRemove redundant close() calls
Michel HERMIER [Fri, 9 Nov 2012 15:53:46 +0000 (15:53 +0000)]
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>
11 years agoMerge branch 'dbus-1.6'
Simon McVittie [Fri, 9 Nov 2012 16:07:44 +0000 (16:07 +0000)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS

11 years agoNEWS
Simon McVittie [Fri, 9 Nov 2012 16:02:53 +0000 (16:02 +0000)]
NEWS

11 years agoDon't leak temporary fds pointing to /dev/null
Michel HERMIER [Fri, 9 Nov 2012 15:44:43 +0000 (15:44 +0000)]
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>
11 years agoUse InterlockedExchange to get a full memory barrier on Windows
Simon McVittie [Mon, 13 Aug 2012 17:00:23 +0000 (18:00 +0100)]
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>
11 years agoinclude README.valgrind in tarballs
Simon McVittie [Fri, 9 Nov 2012 15:28:16 +0000 (15:28 +0000)]
include README.valgrind in tarballs

11 years agoAdd documentation on running clients with Valgrind
Arun Raghavan [Fri, 12 Oct 2012 16:34:11 +0000 (22:04 +0530)]
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>
11 years agobuild: Ensure docs are enabled for distcheck
Colin Walters [Thu, 4 Oct 2012 20:54:02 +0000 (16:54 -0400)]
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>
11 years agoFix building with newer Valgrind
Arun Raghavan [Fri, 12 Oct 2012 16:22:03 +0000 (21:52 +0530)]
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>
12 years agospec: fix command name REJECT -> REJECTED
Pavel Strashkin [Thu, 1 Nov 2012 19:29:23 +0000 (12:29 -0700)]
spec: fix command name REJECT -> REJECTED

Signed-off-by: Pavel Strashkin <pavel.strashkin@nexenta.com>
Signed-off-by: Colin Walters <walters@verbum.org>
12 years agodbus-spawn: fix spacing mistake in comment
Ray Strode [Tue, 16 Oct 2012 19:29:27 +0000 (15:29 -0400)]
dbus-spawn: fix spacing mistake in comment

commit 90f939f155bd120f44ff3906296707a6c00cd462 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

12 years agodbus-spawn: set SIGPIPE to SIG_IGN before activating services
Ray Strode [Tue, 16 Oct 2012 18:38:28 +0000 (14:38 -0400)]
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

12 years agoSet correct address when using --address=systemd:
Simon Peeters [Sun, 7 Oct 2012 14:59:30 +0000 (16:59 +0200)]
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>
12 years agoMerge remote-tracking branch 'origin/master'
Simon McVittie [Thu, 4 Oct 2012 07:55:49 +0000 (08:55 +0100)]
Merge remote-tracking branch 'origin/master'

12 years agoMerge branch 'dbus-1.6'
Simon McVittie [Thu, 4 Oct 2012 07:54:58 +0000 (08:54 +0100)]
Merge branch 'dbus-1.6'

Conflicts:
NEWS
bus/activation-helper.c
configure.ac

12 years agoactivation helper: when compiled for tests, do not reset system bus address
Simon McVittie [Tue, 2 Oct 2012 08:34:48 +0000 (09:34 +0100)]
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

12 years agobuild: Make --disable-xml-docs build work again
Colin Walters [Sun, 8 Jan 2012 17:11:11 +0000 (12:11 -0500)]
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

12 years agoPost-release version bump
Simon McVittie [Tue, 2 Oct 2012 08:47:20 +0000 (09:47 +0100)]
Post-release version bump

12 years agoRevert "hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()"
Colin Walters [Fri, 28 Sep 2012 19:31:47 +0000 (15:31 -0400)]
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 d7ffad72146c2329692e0cf32eb1ac1dbb4fb51c.

12 years agoRevert "hardening: Use __secure_getenv if available"
Colin Walters [Fri, 28 Sep 2012 19:31:05 +0000 (15:31 -0400)]
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 1a556443757b19fee67ef4441141246dd9cfed4f.

12 years agoRelease 1.6.8 dbus-1.6.8 upstream/1.6.8
Colin Walters [Fri, 28 Sep 2012 19:44:59 +0000 (15:44 -0400)]
Release 1.6.8

12 years agoRevert "hardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()"
Colin Walters [Fri, 28 Sep 2012 19:31:47 +0000 (15:31 -0400)]
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 d7ffad72146c2329692e0cf32eb1ac1dbb4fb51c.

12 years agoRevert "hardening: Use __secure_getenv if available"
Colin Walters [Fri, 28 Sep 2012 19:31:05 +0000 (15:31 -0400)]
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 1a556443757b19fee67ef4441141246dd9cfed4f.

12 years agoResume development
Colin Walters [Fri, 28 Sep 2012 17:20:14 +0000 (13:20 -0400)]
Resume development

12 years agoRelease 1.6.6 dbus-1.6.6
Colin Walters [Fri, 28 Sep 2012 17:08:42 +0000 (13:08 -0400)]
Release 1.6.6

12 years agoactivation-helper: Ensure DBUS_STARTER_ADDRESS is set correctly
Geoffrey Thomas [Fri, 28 Sep 2012 05:02:06 +0000 (22:02 -0700)]
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>
12 years agohardening: Remove activation helper handling for DBUS_VERBOSE
Colin Walters [Fri, 28 Sep 2012 16:01:56 +0000 (12:01 -0400)]
hardening: Remove activation helper handling for DBUS_VERBOSE

It's not really useful.

See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17

12 years agohardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()
Colin Walters [Fri, 28 Sep 2012 14:05:59 +0000 (10:05 -0400)]
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

12 years agohardening: Ensure _dbus_check_setuid() is initialized threadsafe manner
Colin Walters [Fri, 28 Sep 2012 01:35:22 +0000 (21:35 -0400)]
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

12 years agohardening: Use __secure_getenv if available
Colin Walters [Fri, 28 Sep 2012 01:29:29 +0000 (21:29 -0400)]
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

12 years agoCVE-2012-3524: Don't access environment variables or run dbus-launch when setuid
Colin Walters [Wed, 22 Aug 2012 14:03:34 +0000 (10:03 -0400)]
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>
12 years agoactivation-helper: Ensure DBUS_STARTER_ADDRESS is set correctly
Geoffrey Thomas [Fri, 28 Sep 2012 05:02:06 +0000 (22:02 -0700)]
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>
12 years agohardening: Remove activation helper handling for DBUS_VERBOSE
Colin Walters [Fri, 28 Sep 2012 16:01:56 +0000 (12:01 -0400)]
hardening: Remove activation helper handling for DBUS_VERBOSE

It's not really useful.

See https://bugs.freedesktop.org/show_bug.cgi?id=52202#c17

12 years agohardening: Use __secure_getenv() in *addition* to _dbus_check_setuid()
Colin Walters [Fri, 28 Sep 2012 14:05:59 +0000 (10:05 -0400)]
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

12 years agohardening: Ensure _dbus_check_setuid() is initialized threadsafe manner
Colin Walters [Fri, 28 Sep 2012 01:35:22 +0000 (21:35 -0400)]
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

12 years agohardening: Use __secure_getenv if available
Colin Walters [Fri, 28 Sep 2012 01:29:29 +0000 (21:29 -0400)]
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

12 years agoCVE-2012-3524: Don't access environment variables or run dbus-launch when setuid
Colin Walters [Wed, 22 Aug 2012 14:03:34 +0000 (10:03 -0400)]
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>
12 years agoMerge branch 'dbus-1.6'
Simon McVittie [Mon, 3 Sep 2012 09:20:01 +0000 (10:20 +0100)]
Merge branch 'dbus-1.6'