]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
5 years agoMerge branch 'issue305' into 'master'
Simon McVittie [Wed, 1 Jul 2020 13:29:39 +0000 (13:29 +0000)] 
Merge branch 'issue305' into 'master'

userdb: Reference-count DBusUserInfo, DBusGroupInfo

Closes #305

See merge request dbus/dbus!166

5 years agouserdb: Reference-count DBusUserInfo, DBusGroupInfo
Simon McVittie [Tue, 30 Jun 2020 18:29:06 +0000 (19:29 +0100)] 
userdb: Reference-count DBusUserInfo, DBusGroupInfo

Previously, the hash table indexed by uid (or gid) took ownership of the
single reference to the heap-allocated struct, and the hash table
indexed by username (or group name) had a borrowed pointer to the same
struct that exists in the other hash table.

However, this can break down if you have two or more distinct usernames
that share a numeric identifier. This is generally a bad idea, because
the user-space model in such situations does not match the kernel-space
reality, and in particular there is no effective kernel-level security
boundary between such users, but it is sometimes done anyway.

In this case, when the second username is looked up in the userdb, it
overwrites (replaces) the entry in the hash table that is indexed by
uid, freeing the DBusUserInfo. This results in both the key and the
value in the hash table that is indexed by username becoming dangling
pointers (use-after-free), leading to undefined behaviour, which is
certainly not what we want to see when doing access control.

An equivalent situation can occur with groups, in the rare case where
a numeric group ID has two names (although I have not heard of this
being done in practice).

Solve this by reference-counting the data structure. There are up to
three references in practice: one held temporarily while the lookup
function is populating and storing it, one held by the hash table that
is indexed by uid, and one held by the hash table that is indexed by
name.

Closes: dbus#305
Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agouserdb: Make lookups return a const pointer
Simon McVittie [Tue, 30 Jun 2020 18:13:17 +0000 (19:13 +0100)] 
userdb: Make lookups return a const pointer

This makes it more obvious that the returned pointer points to a
struct owned by the userdb, which must not be freed or have its
contents modified, and is only valid to dereference until the next
modification to the userdb's underlying hash tables (which in practice
means until the lock is released, because after that we have no
guarantees about what might be going on in another thread).

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'illumos_cmsg' into 'master'
Simon McVittie [Mon, 15 Jun 2020 13:16:51 +0000 (13:16 +0000)] 
Merge branch 'illumos_cmsg' into 'master'

Solaris and derivatives do not adjust cmsg_len on MSG_CTRUNC

Closes #304

See merge request dbus/dbus!165

5 years agoSolaris and derivatives do not adjust cmsg_len on MSG_CTRUNC
Andy Fiddaman [Fri, 12 Jun 2020 12:32:20 +0000 (12:32 +0000)] 
Solaris and derivatives do not adjust cmsg_len on MSG_CTRUNC

5 years agoMerge branch 'cmake-fix-install' into 'master'
Simon McVittie [Wed, 10 Jun 2020 18:22:48 +0000 (18:22 +0000)] 
Merge branch 'cmake-fix-install' into 'master'

cmake: Fix installed files

See merge request dbus/dbus!155

5 years agocmake: add support for user session semantic on Linux operating systems
Ralf Habacker [Mon, 18 May 2020 10:47:51 +0000 (12:47 +0200)] 
cmake: add support for user session semantic on Linux operating systems

Systemd user support is controlled by the cmake variable ENABLE_USER_SESSION,
which and WITH_SYSTEMD_USERUNITDIR to specify a custom installation
location. If WITH_SYSTEMD_USERUNITDIR is not specified, the related install
path is determined from an installed systemd package, if present.

This was added to the Autotools build system as part of fd.o#61301,
but until now was not possible to enable when building with CMake.

5 years agocmake: Add support for systemd integration on Linux operating systems
Ralf Habacker [Mon, 18 May 2020 10:44:37 +0000 (12:44 +0200)] 
cmake: Add support for systemd integration on Linux operating systems

Previously, only the Autotools build system could do this. This commit
includes most of the same features as in the Autotools build, although
not the user-session semantics, which will be added separately.

Systemd support is controlled by the cmake variable ENABLE_SYSTEMD, which can
have the values OFF, ON and AUTO, the latter enabling support by default if
the required libraries are available.

With WITH_SYSTEMD_SYSTEMUNITDIR a custom installation location can be specified.
If it is not specified, the related install path is determined from the installed
systemd package, if present.

5 years agocmake: Add macro check_auto_option() as an addition to add_auto_option()
Ralf Habacker [Mon, 18 May 2020 10:51:03 +0000 (12:51 +0200)] 
cmake: Add macro check_auto_option() as an addition to add_auto_option()

check_auto_option() checks the values given to an auto-option and prints
a fatal error in case of invalid combinations.

5 years agocmake: rename tristateoption() to add_auto_option() and make signature compatible...
Ralf Habacker [Mon, 18 May 2020 10:02:36 +0000 (12:02 +0200)] 
cmake: rename tristateoption() to add_auto_option() and make signature compatible to option()

5 years agocmake: Use CMAKE_INSTALL_FULL_<dir> for configuration and state
Ralf Habacker [Thu, 23 Apr 2020 16:41:03 +0000 (18:41 +0200)] 
cmake: Use CMAKE_INSTALL_FULL_<dir> for configuration and state

This means we apply GNUInstallDirs' various special cases when
the prefix is /, /usr or something starting with /opt; these are
not applied when installing to CMAKE_INSTALL_<dir>. See
https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases

5 years agocmake: fix installation of example files
Ralf Habacker [Thu, 23 Apr 2020 16:37:54 +0000 (18:37 +0200)] 
cmake: fix installation of example files

5 years agoMerge branch 'normalize-trailing-newlines' into 'master'
Simon McVittie [Wed, 10 Jun 2020 10:56:26 +0000 (10:56 +0000)] 
Merge branch 'normalize-trailing-newlines' into 'master'

Normalize C source files to end with exactly one newline

See merge request dbus/dbus!162

5 years agoNormalize C source files to end with exactly one newline
Simon McVittie [Wed, 10 Jun 2020 08:47:15 +0000 (09:47 +0100)] 
Normalize C source files to end with exactly one newline

Some editors automatically remove trailing blank lines, or
automatically add a trailing newline to avoid having a trailing
non-blank line that is not terminated by a newline. To avoid unrelated
whitespace changes when users of such editors contribute to dbus,
let's pre-emptively normalize all files.

Unlike more intrusive whitespace normalization like removing trailing
whitespace from each line, this seems unlikely to cause significant
issues with cherry-picking changes to stable branches.

Implemented by:

    find . -name '*.[ch]' -print0 | \
    xargs -0 perl -0777 -p -i -e 's/\n+\z//g; s/\z/\n/g'

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'misc-comment' into 'master'
Simon McVittie [Wed, 10 Jun 2020 10:46:42 +0000 (10:46 +0000)] 
Merge branch 'misc-comment' into 'master'

dbus-protocol.h: fix DBUS_ERROR_SPAWN_NO_MEMORY comment

See merge request dbus/dbus!163

5 years agodbus-protocol.h: fix DBUS_ERROR_SPAWN_NO_MEMORY comment
Marc-André Lureau [Wed, 10 Jun 2020 10:25:59 +0000 (14:25 +0400)] 
dbus-protocol.h: fix DBUS_ERROR_SPAWN_NO_MEMORY comment

Although this error seems to be unused (DBUS_ERROR_NO_MEMORY is used
instead), let's correct the comment.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5 years agoStart 1.13.18 development
Simon McVittie [Tue, 2 Jun 2020 20:07:31 +0000 (21:07 +0100)] 
Start 1.13.18 development

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoPrepare 1.13.16 dbus-1.13.16
Simon McVittie [Tue, 2 Jun 2020 11:18:05 +0000 (12:18 +0100)] 
Prepare 1.13.16

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agofdpass test: Assert that we don't leak file descriptors
Simon McVittie [Thu, 16 Apr 2020 13:41:48 +0000 (14:41 +0100)] 
fdpass test: Assert that we don't leak file descriptors

Reproduces: dbus#294
Reproduces: CVE-2020-12049
Reproduces: GHSL-2020-057
Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agosysdeps-unix: On MSG_CTRUNC, close the fds we did receive
Simon McVittie [Thu, 16 Apr 2020 13:45:11 +0000 (14:45 +0100)] 
sysdeps-unix: On MSG_CTRUNC, close the fds we did receive

MSG_CTRUNC indicates that we have received fewer fds that we should
have done because the buffer was too small, but we were treating it
as though it indicated that we received *no* fds. If we received any,
we still have to make sure we close them, otherwise they will be leaked.

On the system bus, if an attacker can induce us to leak fds in this
way, that's a local denial of service via resource exhaustion.

Reported-by: Kevin Backhouse, GitHub Security Lab
Fixes: dbus#294
Fixes: CVE-2020-12049
Fixes: GHSL-2020-057
5 years agoUpdate NEWS
Simon McVittie [Mon, 1 Jun 2020 09:46:22 +0000 (10:46 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'ci-run-cross-compiled-tests' into 'master'
Simon McVittie [Fri, 29 May 2020 14:56:15 +0000 (14:56 +0000)] 
Merge branch 'ci-run-cross-compiled-tests' into 'master'

CI: run cross compiled tests

Closes #296

See merge request dbus/dbus!158

5 years agoCI: for cmake show the used command lines when compiling and linking
Ralf Habacker [Fri, 29 May 2020 14:43:24 +0000 (16:43 +0200)] 
CI: for cmake show the used command lines when compiling and linking

This helps to detect incorrect settings.

5 years agoCI: Add running test cases for cross builds
Ralf Habacker [Fri, 29 May 2020 14:40:44 +0000 (16:40 +0200)] 
CI: Add running test cases for cross builds

Before building a wine prefix is created and search pathes
for binaries are configured in the wine prefix.

This commit adds a new shell variable 'ci_runtime' for specifing
the type of compiler support library which defaults to static for now.

5 years agoMerge branch 'wine-symbol-support' into 'master'
Simon McVittie [Thu, 28 May 2020 19:08:29 +0000 (19:08 +0000)] 
Merge branch 'wine-symbol-support' into 'master'

Let Wine display the correct file name and line numbers for backtraces

See merge request dbus/dbus!104

5 years agocmake: Let Wine display the correct file name and line numbers for backtraces
Ralf Habacker [Tue, 5 Feb 2019 13:46:51 +0000 (14:46 +0100)] 
cmake: Let Wine display the correct file name and line numbers for backtraces

Wine currently only supports the symbol formats STABS and DWARF 2,
but not the other versions, with STABS providing the most information
and being the first choice.

Since we already use the cmake variable DBUS_USE_WINE for running tests
under Wine, we also use it to activate the special symbol format.

Closes dbus/dbus/#133

5 years ago.gitlab-ci.yml: Use x86_64 build chain to cross build 64bit executables
Ralf Habacker [Fri, 1 May 2020 11:27:20 +0000 (13:27 +0200)] 
.gitlab-ci.yml: Use x86_64 build chain to cross build 64bit executables

This error was discovered when working with the merge request
dbus/dbus!158.

5 years agocmake: Fix setting default value for DBUS_BUILD_TESTS too late
Ralf Habacker [Tue, 28 Apr 2020 19:52:47 +0000 (21:52 +0200)] 
cmake: Fix setting default value for DBUS_BUILD_TESTS too late

This prevented setting cross compile support required for !158.

5 years agoMerge branch 'cmake-build-missing-tools' into 'master'
Ralf Habacker [Thu, 30 Apr 2020 00:31:04 +0000 (00:31 +0000)] 
Merge branch 'cmake-build-missing-tools' into 'master'

Build missing tools with cmake

See merge request dbus/dbus!154

5 years agocmake: build and install dbus-cleanup-sockets on non Windows platforms
Ralf Habacker [Wed, 22 Apr 2020 13:03:30 +0000 (15:03 +0200)] 
cmake: build and install dbus-cleanup-sockets on non Windows platforms

5 years agocmake: build and install dbus-uuidgen on non Windows platforms
Ralf Habacker [Mon, 27 Apr 2020 18:19:57 +0000 (20:19 +0200)] 
cmake: build and install dbus-uuidgen on non Windows platforms

5 years agoMerge branch 'qthelp-docs-support' into 'master'
Ralf Habacker [Wed, 29 Apr 2020 15:32:32 +0000 (15:32 +0000)] 
Merge branch 'qthelp-docs-support' into 'master'

Add support to generate the api documentation in Qt help format

See merge request dbus/dbus!150

5 years agoAdd support to generate the api documentation in Qt help format
Ralf Habacker [Tue, 28 Apr 2020 17:03:59 +0000 (19:03 +0200)] 
Add support to generate the api documentation in Qt help format

Qt help files are used by Qt Creator and KDevelop, for example, to support
the development of Qt-based applications and libraries.

Generating api documentation in Qt help format is controlled by two
user specific options named --enable-qt-help and --with-qchdir (autotools)
and -DENABLE_QT_HELP and -DINSTALL_QCH_DIR (cmake).

5 years agocmake: remove component 'dev' as we never used that consistently
Ralf Habacker [Mon, 27 Apr 2020 20:12:18 +0000 (22:12 +0200)] 
cmake: remove component 'dev' as we never used that consistently

Marking targets with a component would only be useful if we
marked every target with a component in a consistent way,
but because we don't do that, it's pointless to have it
in just a few places.

5 years agoMerge branch 'fix-dbus_poll-buffer-overflow' into 'master'
Simon McVittie [Wed, 29 Apr 2020 10:59:08 +0000 (10:59 +0000)] 
Merge branch 'fix-dbus_poll-buffer-overflow' into 'master'

_dbus_poll(): Prevent buffer overflow in Windows verbose logging

See merge request dbus/dbus!125

5 years agoFix return type and usage of WSAWaitForMultipleEvents()
Ralf Habacker [Tue, 3 Dec 2019 01:23:29 +0000 (02:23 +0100)] 
Fix return type and usage of WSAWaitForMultipleEvents()

The former int type leads to warnings.

5 years agoAdd debug output functions for _dbus_poll_xx() functions
Ralf Habacker [Tue, 28 Apr 2020 05:06:41 +0000 (07:06 +0200)] 
Add debug output functions for _dbus_poll_xx() functions

5 years agoFix bug not detecting out of memory condition in _dbus_poll_events ()
Ralf Habacker [Tue, 28 Apr 2020 05:02:09 +0000 (07:02 +0200)] 
Fix bug not detecting out of memory condition in _dbus_poll_events ()

For cleaning purpose the event list members are initialized with
WSA_INVALID_EVENT. The cleanup code detects and handles the
case that the event list has been created from calloc ().

5 years agoSeparate the event based implementation for _dbus_poll() from the fd based one
Ralf Habacker [Tue, 28 Apr 2020 05:04:25 +0000 (07:04 +0200)] 
Separate the event based implementation for _dbus_poll() from the fd based one

The function _dbus_poll() has been split into two functions,
_dbus_poll_events() and _dbus_poll_select(), each containing the
corresponding implementation.

_dbus_poll() now calls the corresponding function.

5 years agodbus_poll(): Remove debug output to make room for a better implementation
Ralf Habacker [Tue, 3 Dec 2019 00:29:10 +0000 (01:29 +0100)] 
dbus_poll(): Remove debug output to make room for a better implementation

5 years agoMerge branch 'shell-test-tap' into 'master'
Simon McVittie [Tue, 28 Apr 2020 11:00:29 +0000 (11:00 +0000)] 
Merge branch 'shell-test-tap' into 'master'

shell-test: Print diagnostics to stderr

See merge request dbus/dbus!157

5 years agoshell-test: Print diagnostics to stderr
Félix Piédallu [Mon, 27 Apr 2020 18:15:54 +0000 (20:15 +0200)] 
shell-test: Print diagnostics to stderr

Some of the command-lines that we print as diagnostics contain newlines,
which will cause warnings or errors under a strict TAP parser (and one of
them wasn't correctly prefixed with '#' anyway). TAP parsers only parse
stdout, not stderr, so we can use stderr for these diagnostic messages.

[smcv: Expand commit message]

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'coverity-354884' into 'master'
Ralf Habacker [Mon, 27 Apr 2020 15:15:10 +0000 (15:15 +0000)] 
Merge branch 'coverity-354884' into 'master'

Free allocated buffer in test_content() to avoid a resource leak

See merge request dbus/dbus!146

5 years agodesktop-file test: Free result on all code paths
Ralf Habacker [Sat, 18 Apr 2020 11:34:19 +0000 (13:34 +0200)] 
desktop-file test: Free result on all code paths

Otherwise, Coverity will diagnose this as a resource leak,
because it doesn't understand that our assertions end up guaranteeing
that the result is freed if and only if it's non-`NULL`.

Coverity CID: 354884

5 years agoMerge branch 'dbus-get-autolaunch-address-stderr-fixes' into 'master'
Ralf Habacker [Mon, 27 Apr 2020 12:16:46 +0000 (12:16 +0000)] 
Merge branch 'dbus-get-autolaunch-address-stderr-fixes' into 'master'

In dbus_get_autolaunch_address() return all errors as dbus error

Closes #191

See merge request dbus/dbus!131

5 years agoIn dbus_get_autolaunch_address() return all errors as dbus error
Ralf Habacker [Sat, 18 Apr 2020 08:52:37 +0000 (10:52 +0200)] 
In dbus_get_autolaunch_address() return all errors as dbus error

This provides a consistent error reporting.

Fixes #191

5 years agoFix indention in _dbus_get_autolaunch_address()
Ralf Habacker [Sat, 18 Apr 2020 08:53:34 +0000 (10:53 +0200)] 
Fix indention in _dbus_get_autolaunch_address()

5 years agoMerge branch 'dbus_logv-uses-dbusstring' into 'master'
Ralf Habacker [Mon, 27 Apr 2020 12:01:30 +0000 (12:01 +0000)] 
Merge branch 'dbus_logv-uses-dbusstring' into 'master'

Fix possible truncation of protocol output in dbus_logv()

See merge request dbus/dbus!134

5 years ago_dbus_verbose_real: Use the Python convention for quoting potentially multi-line...
Ralf Habacker [Mon, 27 Apr 2020 12:01:30 +0000 (12:01 +0000)] 
_dbus_verbose_real: Use the Python convention for quoting potentially multi-line strings when memory is unavailable on Windows

5 years agoStart dbus 1.13.16 development
Simon McVittie [Tue, 21 Apr 2020 20:02:03 +0000 (21:02 +0100)] 
Start dbus 1.13.16 development

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoReference implementation v1.13.14 and Specification v0.36 dbus-1.13.14
Simon McVittie [Tue, 21 Apr 2020 10:25:27 +0000 (11:25 +0100)] 
Reference implementation v1.13.14 and Specification v0.36

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoUpdate NEWS
Simon McVittie [Mon, 20 Apr 2020 18:28:05 +0000 (19:28 +0100)] 
Update NEWS

5 years agoMerge branch 'more-modular-tests' into 'master'
Simon McVittie [Mon, 20 Apr 2020 17:46:52 +0000 (17:46 +0000)] 
Merge branch 'more-modular-tests' into 'master'

Make more tests modular

See merge request dbus/dbus!153

5 years agotest: Replace some _dbus_assert() with _dbus_test_check()
Simon McVittie [Thu, 16 Apr 2020 13:23:17 +0000 (14:23 +0100)] 
test: Replace some _dbus_assert() with _dbus_test_check()

Assertions can be disabled, but in test code the assertions are the
whole point, so use checks that can't be disabled instead.

Because there's a lot of test code, I haven't done this globally, only
in the tests that I recently converted from "embedded" to "modular".

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agotest: Replace _dbus_assert_not_reached()
Simon McVittie [Thu, 16 Apr 2020 13:21:36 +0000 (14:21 +0100)] 
test: Replace _dbus_assert_not_reached()

Assertions can be disabled; but in test code the assertions are the
entire point, so we don't want to disable them. Use _dbus_test_fatal()
instead.

test-service is actually a test helper rather than a test, so use its
pre-existing die() function instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agotest: Enable more tests when embedded tests are disabled
Simon McVittie [Thu, 16 Apr 2020 13:18:49 +0000 (14:18 +0100)] 
test: Enable more tests when embedded tests are disabled

These previously relied on embedding test-specific code in libdbus,
but they actually only need public APIs, private interfaces that get
exported anyway for the benefit of dbus-daemon, and the TAP helpers;
so we can run them even in production builds.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agotest: Move TAP helpers into dbus-testutils if embedded tests are disabled
Simon McVittie [Thu, 16 Apr 2020 13:15:18 +0000 (14:15 +0100)] 
test: Move TAP helpers into dbus-testutils if embedded tests are disabled

This lets us run a subset of the tests that previously relied on extra
test-only code being compiled into libdbus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years ago_dbus_test_check: Wrap body of macro in do/while
Simon McVittie [Thu, 16 Apr 2020 13:11:09 +0000 (14:11 +0100)] 
_dbus_test_check: Wrap body of macro in do/while

This avoids unexpected precedence when used as the body of an "if" or
"else" without being wrapped in {}.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'ci-updates' into 'master'
Simon McVittie [Thu, 16 Apr 2020 10:25:39 +0000 (10:25 +0000)] 
Merge branch 'ci-updates' into 'master'

CI: Update to Debian 10 'buster', drop Debian 8 'jessie', add qhelpgenerator

See merge request dbus/dbus!151

5 years agoMerge branch 'fix-bar-length' into 'master'
Simon McVittie [Thu, 16 Apr 2020 09:49:37 +0000 (09:49 +0000)] 
Merge branch 'fix-bar-length' into 'master'

spec: fix typo in example

See merge request dbus/dbus!152

5 years agospec: fix typo in example
Zygmunt Krynicki [Thu, 16 Apr 2020 06:55:42 +0000 (06:55 +0000)] 
spec: fix typo in example

The length of "bar" is encoded as 3. The annotation is incorrect.

5 years agoCI: Install qhelpgenerator for native production build on buster
Simon McVittie [Mon, 6 Apr 2020 13:53:19 +0000 (14:53 +0100)] 
CI: Install qhelpgenerator for native production build on buster

This will be used in dbus!150.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoCI: Don't build on Debian 8 'jessie'
Simon McVittie [Mon, 6 Apr 2020 13:50:02 +0000 (14:50 +0100)] 
CI: Don't build on Debian 8 'jessie'

Debian 8 'jessie' has reached EOL for mainstream security support,
which puts it outside our usual distribution/OS support policy.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoCI: Build on Debian 10 'buster' by default
Simon McVittie [Mon, 6 Apr 2020 13:48:11 +0000 (14:48 +0100)] 
CI: Build on Debian 10 'buster' by default

Previously, we built on Debian 9 'stretch' by default, and on
Debian 10 'buster' only on request. Let's reverse that so that we get
more modern toolchains, before Debian 9 'stretch' reaches EOL.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'fix-poll-header' into 'master'
Simon McVittie [Wed, 1 Apr 2020 14:17:52 +0000 (14:17 +0000)] 
Merge branch 'fix-poll-header' into 'master'

sysdeps: use POSIX poll.h instead of sys/poll.h

See merge request dbus/dbus!148

5 years agoMerge branch 'fallback_to_getrandom' into 'master'
Simon McVittie [Wed, 1 Apr 2020 14:16:39 +0000 (14:16 +0000)] 
Merge branch 'fallback_to_getrandom' into 'master'

_dbus_generate_random_bytes: fallback to getrandom(2)

See merge request dbus/dbus!147

5 years agosysdeps: use POSIX poll.h instead of sys/poll.h
Natanael Copa [Tue, 24 Mar 2020 11:04:24 +0000 (12:04 +0100)] 
sysdeps: use POSIX poll.h instead of sys/poll.h

POSIX.1-2001 and POSIX.1-2008 specifies include <poll.h> so use that
rather than the non-standard/legacy include <sys/poll.h>.

This fixes the following warnings when building with musl libc:

    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
5 years ago_dbus_generate_random_bytes: use getrandom(2)
Natanael Copa [Tue, 24 Mar 2020 10:31:41 +0000 (11:31 +0100)] 
_dbus_generate_random_bytes: use getrandom(2)

Use getrandom(2) and fall back to /dev/urandom if it is missing or if it
fails some any reason.

This solves problem where dbus-uuidgen is called from a chroot which
lacks /dev/urandom.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
5 years agoMerge branch 'fix_indentation' into 'master'
Simon McVittie [Wed, 25 Mar 2020 14:19:40 +0000 (14:19 +0000)] 
Merge branch 'fix_indentation' into 'master'

Fix indentation in bus source file

See merge request dbus/dbus!149

5 years agoFix indentation in bus source file
Taras Zaporozhets [Wed, 25 Mar 2020 12:22:38 +0000 (13:22 +0100)] 
Fix indentation in bus source file

5 years agoMerge branch 'mr143-refactoring' into 'master'
Ralf Habacker [Wed, 11 Mar 2020 16:13:47 +0000 (16:13 +0000)] 
Merge branch 'mr143-refactoring' into 'master'

sysdeps-win: Refactor cleanup of struct addrinfo during connect()

See merge request dbus/dbus!145

5 years agoMerge branch 'non-posix-getwpnam-r' into 'master'
Simon McVittie [Wed, 11 Mar 2020 14:15:29 +0000 (14:15 +0000)] 
Merge branch 'non-posix-getwpnam-r' into 'master'

Remove support for non-POSIX getpwnam_r()

See merge request dbus/dbus!11

5 years agoMerge branch 'mr143-but-unix' into 'master'
Simon McVittie [Wed, 11 Mar 2020 14:11:09 +0000 (14:11 +0000)] 
Merge branch 'mr143-but-unix' into 'master'

sysdeps-unix: Don't leak struct addrinfo on OOM during connect()

See merge request dbus/dbus!144

5 years agosysdeps-win: Refactor cleanup of struct addrinfo during connect()
Simon McVittie [Wed, 11 Mar 2020 13:14:45 +0000 (13:14 +0000)] 
sysdeps-win: Refactor cleanup of struct addrinfo during connect()

As suggested on !143. Instead of remembering to free it in every error
condition, let's move its cleanup to the "out" phase so that it's done
every time.

Change the iterator variable tmp to be const so that it's obvious we
aren't meant to free that too.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agosysdeps-unix: Don't leak struct addrinfo on OOM during connect()
Simon McVittie [Wed, 11 Mar 2020 13:12:22 +0000 (13:12 +0000)] 
sysdeps-unix: Don't leak struct addrinfo on OOM during connect()

If we ran out of memory while handling connect() errors, we didn't
free the linked list of struct addrinfo. Move their cleanup to the
"out" phase of the function so that we always do it.

While I'm there, change the iterator variable tmp to be const, to make
it more obvious that we aren't meant to free it.

This is similar to commit 00badeba (!143) in the corresponding Windows
code path, but with some refactoring.

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agoMerge branch 'coverity-354880' into 'master'
Simon McVittie [Wed, 11 Mar 2020 13:03:34 +0000 (13:03 +0000)] 
Merge branch 'coverity-354880' into 'master'

Fix missing release of the memory allocated in _dbus_connect_tcp_socket_with_nonce() in OOM case

See merge request dbus/dbus!143

5 years agoFix missing release of the memory allocated in _dbus_connect_tcp_socket_with_nonce...
Ralf Habacker [Tue, 10 Mar 2020 21:59:19 +0000 (22:59 +0100)] 
Fix missing release of the memory allocated in _dbus_connect_tcp_socket_with_nonce() in OOM case

If there is no more memory available within the mentiond function, e.g.,
when checking memory management, the release of memory allocated by
getaddrinfo() is missing.

Coverity CID: 354880

5 years agoMerge branch 'monitor-list' into 'master'
Simon McVittie [Tue, 25 Feb 2020 12:49:44 +0000 (12:49 +0000)] 
Merge branch 'monitor-list' into 'master'

bus: Don't explicitly clear BusConnections.monitors

Closes #291

See merge request dbus/dbus!140

5 years agoMerge branch 'fix-cmake-doc-build' into 'master'
Simon McVittie [Fri, 21 Feb 2020 00:59:46 +0000 (00:59 +0000)] 
Merge branch 'fix-cmake-doc-build' into 'master'

Fix cmake doc build

See merge request dbus/dbus!137

5 years agocmake: Don't build dbus.devhelp2 if Doxygen is disabled
Ralf Habacker [Thu, 20 Feb 2020 10:04:25 +0000 (11:04 +0100)] 
cmake: Don't build dbus.devhelp2 if Doxygen is disabled

Previously this would be attempted whenever xsltproc was found, but
would fail if Doxygen documentation was disabled.

5 years agoUpdate NEWS
Simon McVittie [Thu, 20 Feb 2020 13:14:06 +0000 (13:14 +0000)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
5 years agobus: Don't explicitly clear BusConnections.monitors
Simon McVittie [Thu, 20 Feb 2020 00:36:53 +0000 (00:36 +0000)] 
bus: Don't explicitly clear BusConnections.monitors

Each connection that is an active monitor holds a pointer to its own
link in this list, via BusConnectionData.link_in_monitors. We can't
validly free the list while these pointers exist: that would be a
use-after-free, when each connection gets disconnected and tries to
remove itself from the list.

Instead, let each connection remove itself from the list, then assert
that the list has become empty.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/291

5 years agoMerge branch 'let-dbus_verbose_real-use-dbus-string' into 'master'
Simon McVittie [Thu, 20 Feb 2020 08:50:01 +0000 (08:50 +0000)] 
Merge branch 'let-dbus_verbose_real-use-dbus-string' into 'master'

In _dbus_verbose_real() use DBusString instance to avoid possible stack smashing

Closes #45

See merge request dbus/dbus!133

5 years agoIn _dbus_verbose_real() avoid possible stack overflows on output to the Windows debug...
Ralf Habacker [Thu, 20 Feb 2020 08:50:00 +0000 (08:50 +0000)] 
In _dbus_verbose_real() avoid possible stack overflows on output to the Windows debug port

Instead of creating a fixed memory area on the stack that can lead to
a stack overflow if exceeded, this configuration now uses a DBusString
instance that dynamically manages memory.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/45

5 years agoMerge branch 'utf8-compliant-versioninfo' into 'master'
Simon McVittie [Thu, 20 Feb 2020 08:34:04 +0000 (08:34 +0000)] 
Merge branch 'utf8-compliant-versioninfo' into 'master'

Transcoding template file for version information under Windows to utf-8

See merge request dbus/dbus!139

5 years agoUpdate copyright year in file template for version info on Windows
Ralf Habacker [Thu, 20 Feb 2020 07:47:55 +0000 (08:47 +0100)] 
Update copyright year in file template for version info on Windows

5 years agoMake template file for version info under Windows utf-8 compliant
Ralf Habacker [Thu, 20 Feb 2020 07:42:43 +0000 (08:42 +0100)] 
Make template file for version info under Windows utf-8 compliant

5 years agoMerge branch 'fix-libdbus-version-info' into 'master'
Simon McVittie [Thu, 20 Feb 2020 01:02:48 +0000 (01:02 +0000)] 
Merge branch 'fix-libdbus-version-info' into 'master'

Fix libdbus version info

See merge request dbus/dbus!138

5 years agocmake: Fix attribute 'original file name' in shared dbus library file info on Windows
Ralf Habacker [Wed, 19 Feb 2020 10:12:07 +0000 (11:12 +0100)] 
cmake: Fix attribute 'original file name' in shared dbus library file info on Windows

The 'original filename' attribute was 'libdbus-1-3}.dll' with an unwanted
curly bracket.

5 years agoMerge branch 'complete-version-info-on-windows' into 'master'
Simon McVittie [Wed, 19 Feb 2020 20:58:16 +0000 (20:58 +0000)] 
Merge branch 'complete-version-info-on-windows' into 'master'

cmake: complete adding version info to all installed executables on Windows

See merge request dbus/dbus!136

5 years agocmake: complete adding version info to all installed executables on Windows
Ralf Habacker [Wed, 19 Feb 2020 09:23:01 +0000 (10:23 +0100)] 
cmake: complete adding version info to all installed executables on Windows

5 years agoMerge branch 'master' into 'master'
Simon McVittie [Thu, 23 Jan 2020 11:36:21 +0000 (11:36 +0000)] 
Merge branch 'master' into 'master'

cmake: add X11 include directories to tools

See merge request dbus/dbus!129

5 years agocmake: Add X11 include path for tools
Tuomo Rinne [Wed, 22 Jan 2020 21:31:15 +0000 (21:31 +0000)] 
cmake: Add X11 include path for tools

Fixes compilation issues for case when X11 is not in a standard location

6 years agoMerge branch 'fix-static-vars-thread-safety-issues' into 'master'
Ralf Habacker [Fri, 13 Dec 2019 15:20:59 +0000 (15:20 +0000)] 
Merge branch 'fix-static-vars-thread-safety-issues' into 'master'

Fix static vars thread safety issues

Related to dbus/dbus#88

See merge request dbus/dbus!132

6 years agoAdd a trivial sanity-check for the atomic primitives
Ralf Habacker [Thu, 12 Dec 2019 08:34:58 +0000 (09:34 +0100)] 
Add a trivial sanity-check for the atomic primitives

This doesn't verify that they're atomic, but does verify that they
return the right things.

This commit adds a new test function _dbus_test_check (a) to make
writing tests easier. It checks the given boolean expression and
generates a "not ok" test result if the expression is false.

Due to the current design of the test api, the test is only compiled
if embedded tests were enabled at the time of configuration.

It was also necessary to move the test_atomic target definitions in
test/Makefile.am to the --enable-embedded-tests section to avoid a
make distcheck build error.

The test case itself has been authored by smcv.

Co-authored-by: Simon McVittie <smcv@collabora.com>
6 years ago_dbus_modify_sigpipe: be thread-safe
Simon McVittie [Fri, 6 Dec 2019 01:54:18 +0000 (02:54 +0100)] 
_dbus_modify_sigpipe: be thread-safe

This needs new atomic primitives: we don't have "set to a value",
and in fact that's a bit annoying to implement in terms of gcc
intrinsics. "Set to 0" and "set to nonzero" are easy, though.

6 years agovarious: comment static variables that are locked or otherwise OK
Simon McVittie [Tue, 3 Sep 2013 11:33:37 +0000 (12:33 +0100)] 
various: comment static variables that are locked or otherwise OK

6 years agoMerge branch 'no-mapping2' into 'master'
Simon McVittie [Wed, 23 Oct 2019 11:03:16 +0000 (11:03 +0000)] 
Merge branch 'no-mapping2' into 'master'

Stop using selinux_set_mapping() function

Closes #198

See merge request dbus/dbus!128

6 years agoStop using selinux_set_mapping() function
Laurent Bigonville [Sat, 3 Mar 2018 10:15:23 +0000 (11:15 +0100)] 
Stop using selinux_set_mapping() function

Currently, if the "dbus" security class or the associated AV doesn't
exist, dbus-daemon fails to initialize and exits immediately. Also the
security classes or access vector cannot be reordered in the policy.
This can be a problem for people developing their own policy or trying
to access a machine where, for some reasons, there is not policy defined
at all.

The code here copy the behaviour of the selinux_check_access() function.
We cannot use this function here as it doesn't allow us to define the
AVC entry reference.

See the discussion at https://marc.info/?l=selinux&m=152163374332372&w=2

Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/198

6 years agoMerge branch 'fix_1' into 'master'
Ralf Habacker [Mon, 23 Sep 2019 12:50:25 +0000 (12:50 +0000)] 
Merge branch 'fix_1' into 'master'

doxygen: fix example for dbus_message_append_args

See merge request dbus/dbus!126