Commit graph

5881 commits

Author SHA1 Message Date
Simon McVittie
773f136787 Merge branch 'utf8-compliant-versioninfo' into 'master'
Transcoding template file for version information under Windows to utf-8

See merge request dbus/dbus!139
2020-02-20 08:34:04 +00:00
Ralf Habacker
2eae3d86b7 Update copyright year in file template for version info on Windows 2020-02-20 08:48:30 +01:00
Ralf Habacker
96e5cf3789 Make template file for version info under Windows utf-8 compliant 2020-02-20 08:48:30 +01:00
Simon McVittie
6dc7b49098 Merge branch 'fix-libdbus-version-info' into 'master'
Fix libdbus version info

See merge request dbus/dbus!138
2020-02-20 01:02:48 +00:00
Ralf Habacker
8ffe1b949c 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.
2020-02-19 23:41:08 +01:00
Simon McVittie
a60f4a2ca0 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
2020-02-19 20:58:16 +00:00
Ralf Habacker
2d256d42ce cmake: complete adding version info to all installed executables on Windows 2020-02-19 10:23:01 +01:00
Simon McVittie
bfad7898cc Merge branch 'master' into 'master'
cmake: add X11 include directories to tools

See merge request dbus/dbus!129
2020-01-23 11:36:21 +00:00
Tuomo Rinne
5314ced357 cmake: Add X11 include path for tools
Fixes compilation issues for case when X11 is not in a standard location
2020-01-22 21:56:53 +00:00
Ralf Habacker
5f75ed43c5 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
2019-12-13 15:20:59 +00:00
Ralf Habacker
e4feb9600e 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>
2019-12-13 16:13:53 +01:00
Simon McVittie
bf20f73873 _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.
2019-12-12 09:36:32 +01:00
Simon McVittie
4e3d6bffe2 various: comment static variables that are locked or otherwise OK 2019-12-12 09:36:24 +01:00
Simon McVittie
5c0575850f Merge branch 'no-mapping2' into 'master'
Stop using selinux_set_mapping() function

Closes #198

See merge request dbus/dbus!128
2019-10-23 11:03:16 +00:00
Laurent Bigonville
6072f8b241 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
2019-10-22 19:12:13 +02:00
Ralf Habacker
baffedbac9 Merge branch 'fix_1' into 'master'
doxygen: fix example for dbus_message_append_args

See merge request dbus/dbus!126
2019-09-23 12:50:25 +00:00
Felipe Franciosi
e6b8022ca6 doxygen: fix example for dbus_message_append_args
Commit 724adb2f6 mangled the dbus_message_append_args() code example.
This fixes it by breaking the lines and aligning at the right places.

Signed-off-by: Felipe Franciosi <felipe@nutanix.com>
2019-09-23 13:22:32 +01:00
Simon McVittie
9458bd7038 Merge branch '275-docs-fix' into 'master'
doc: Fix environment variable name in dbus-daemon(1)

Closes #275

See merge request dbus/dbus!122
2019-08-19 08:10:19 +00:00
Philip Withnall
bf71a58e4a doc: Fix environment variable name in dbus-daemon(1)
Spotted by Mubin. This documentation relates to the code in
add_bus_environment() in bus/activation.c.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Fixes: #275
2019-08-13 16:08:03 +02:00
Simon McVittie
b9e3c80d1f Merge branch 'dbus-send-sender' into 'master'
dbus-send: add --sender option

See merge request dbus/dbus!116
2019-07-15 12:36:50 +00:00
Christopher Morin
9842689a29 dbus-send: add --sender option
Clients listening for a signal can match against the 'sender', expecting
it to come from a connection with a specific name. With this change,
dbus-send can send signals to them.
2019-07-15 12:36:50 +00:00
Simon McVittie
1823c8e14a Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 15:01:22 +01:00
Simon McVittie
ac5cdd281a Merge branch 'break-out-more-tests' into 'master'
Break out more tests from libdbus

See merge request dbus/dbus!121
2019-07-03 13:43:25 +00:00
Simon McVittie
f73b40b883 Merge branch 'pass-tests-if-root' into 'master'
Fix test failures when running as root

See merge request dbus/dbus!117
2019-07-03 13:42:07 +00:00
Simon McVittie
b8912cf770 Merge branch 'malloc-fail-diags' into 'master'
tests: Improve diagnostics for malloc-failure tests

See merge request dbus/dbus!118
2019-07-03 13:41:21 +00:00
Simon McVittie
47148c6b55 Merge branch 'auth-idempotent' into 'master'
auth: Clear GUID from server if out of memory

See merge request dbus/dbus!119
2019-07-03 13:41:11 +00:00
Simon McVittie
379eb3a253 Merge branch 'fdleak-diagnostics' into 'master'
Move fd-leak checking from dbus/ into test/, and improve diagnostics

See merge request dbus/dbus!120
2019-07-03 13:40:54 +00:00
Simon McVittie
95db64700a tests: Move userdb test out of libdbus
All the functions under test turn out to be DBUS_PRIVATE_EXPORT already.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:19:50 +01:00
Simon McVittie
c1412056bb tests: Move mempool test out of libdbus
All the functions under test turn out to be DBUS_PRIVATE_EXPORT already.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:19:47 +01:00
Simon McVittie
7386456e4b tests: Move address test out of libdbus
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:19:19 +01:00
Simon McVittie
78d5af5ce9 tests: Move _dbus_sha_test outside libdbus
Instead of exposing _dbus_sha_test() as a private exported symbol,
we can expose _dbus_sha_compute(), which is the only thing called by
the test that isn't already exported.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:18:49 +01:00
Simon McVittie
043494618e Introduce a new macro to export symbols solely for tests
This lets us expose symbols in the embedded-tests build without
expanding the symbol table of the production library.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:17:27 +01:00
Simon McVittie
8421d887aa bus tests: Shut down audit socket
Some CI environments run build-time tests as root with CAP_AUDIT_WRITE.
In this case we need to close the audit socket so that it will not be
reported as leaked.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:11:23 +01:00
Simon McVittie
1b1c5ddd35 bus: Make audit initialization idempotent
The audit module is initialized every time a new BusContext is created,
which is only once in the real dbus-daemon, but can happen several times
in some unit tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:11:23 +01:00
Simon McVittie
e148aa47d3 tests: Skip if unable to launch uninstalled dbus-daemon as other uid
Some CI systems do the entire build as uid 0 in a throwaway container.
If this is done in a build directory for which the messagebus user
does not have search (+x) permission, then they will be unable to
execute the just-built dbus-daemon binary.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:11:23 +01:00
Simon McVittie
505bbfe4bd tests: Skip system bus test if we are root but messagebus does not exist
Some CI systems do the build as root in a disposable container, and
run tests without ever having installed dbus. This means we can't
expect to be able to drop privileges from root to the DBUS_USER (usually
named messagebus or dbus) unless we have checked that the
DBUS_USER exists.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-03 11:11:23 +01:00
Simon McVittie
fd41caa366 Merge branch 'doc-fix' into 'master'
doc: replace dbus-send's --address with --peer and --bus

See merge request dbus/dbus!115
2019-07-03 08:28:29 +00:00
Christopher Morin
75bf56e16d Apply suggestion to doc/dbus-send.1.xml.in 2019-07-03 00:20:12 +00:00
Christopher Morin
738d5af0df Apply suggestion to doc/dbus-send.1.xml.in 2019-07-02 22:53:36 +00:00
Simon McVittie
4876dbb161 tests: Improve diagnostics for malloc-failure tests
Some of these appear to hang, but making this diagnostic appear in the
log reveals the truth: it's just very slow.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-02 20:45:59 +01:00
Simon McVittie
0cc191f8e8 auth: Clear GUID from server if out of memory
If we retry processing the message in response to OOM, but we don't
clear this buffer first, then the assertion at the beginning will fail.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-02 20:45:31 +01:00
Simon McVittie
e4e904a86b tests: Improve messages when fd leaks are diagnosed
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-02 20:44:33 +01:00
Simon McVittie
491a2da305 dbus-message-util: Fix Doxygen annotations
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-02 20:44:33 +01:00
Simon McVittie
0ba41e071c Move _dbus_check_fdleaks_* from dbus-message-util to tests
This is only called from test code.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-07-02 20:44:33 +01:00
Chris Morin
1995fb8bb4 doc: replace dbus-send's --address with --peer and --bus
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48816
2019-06-13 20:51:10 -07:00
Simon McVittie
0b8878133f Start spec 0.36 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 16:28:34 +01:00
Simon McVittie
942bb14708 Start 1.13.14 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 16:28:25 +01:00
Simon McVittie
df9dabe521 Prepare version 1.13.12
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-09 13:09:15 +01:00
Simon McVittie
6231e7d75f test: Add basic test coverage for DBUS_COOKIE_SHA1
We don't actually complete successful authentication, because that
would require us to generate a cookie and compute the correct SHA1,
which is difficult to do in a deterministic authentication script.
However, we do assert that dbus#269 (CVE-2019-12749) has been fixed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-09 13:08:53 +01:00
Simon McVittie
2a11ab9bbd auth: Reject DBUS_COOKIE_SHA1 for users other than the server owner
The DBUS_COOKIE_SHA1 authentication mechanism aims to prove ownership
of a shared home directory by having the server write a secret "cookie"
into a .dbus-keyrings subdirectory of the desired identity's home
directory with 0700 permissions, and having the client prove that it can
read the cookie. This never actually worked for non-malicious clients in
the case where server uid != client uid (unless the server and client
both have privileges, such as Linux CAP_DAC_OVERRIDE or traditional
Unix uid 0) because an unprivileged server would fail to write out the
cookie, and an unprivileged client would be unable to read the resulting
file owned by the server.

Additionally, since dbus 1.7.10 we have checked that ~/.dbus-keyrings
is owned by the uid of the server (a side-effect of a check added to
harden our use of XDG_RUNTIME_DIR), further ruling out successful use
by a non-malicious client with a uid differing from the server's.

Joe Vennix of Apple Information Security discovered that the
implementation of DBUS_COOKIE_SHA1 was susceptible to a symbolic link
attack: a malicious client with write access to its own home directory
could manipulate a ~/.dbus-keyrings symlink to cause the DBusServer to
read and write in unintended locations. In the worst case this could
result in the DBusServer reusing a cookie that is known to the
malicious client, and treating that cookie as evidence that a subsequent
client connection came from an attacker-chosen uid, allowing
authentication bypass.

This is mitigated by the fact that by default, the well-known system
dbus-daemon (since 2003) and the well-known session dbus-daemon (in
stable releases since dbus 1.10.0 in 2015) only accept the EXTERNAL
authentication mechanism, and as a result will reject DBUS_COOKIE_SHA1
at an early stage, before manipulating cookies. As a result, this
vulnerability only applies to:

* system or session dbus-daemons with non-standard configuration
* third-party dbus-daemon invocations such as at-spi2-core (although
  in practice at-spi2-core also only accepts EXTERNAL by default)
* third-party uses of DBusServer such as the one in Upstart

Avoiding symlink attacks in a portable way is difficult, because APIs
like openat() and Linux /proc/self/fd are not universally available.
However, because DBUS_COOKIE_SHA1 already doesn't work in practice for
a non-matching uid, we can solve this vulnerability in an easier way
without regressions, by rejecting it early (before looking at
~/.dbus-keyrings) whenever the requested identity doesn't match the
identity of the process hosting the DBusServer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: https://gitlab.freedesktop.org/dbus/dbus/issues/269
Closes: CVE-2019-12749
2019-06-09 13:08:22 +01:00