Commit graph

6099 commits

Author SHA1 Message Date
Ralf Habacker
7ec42d28fc _dbus_poll_select (): fix concating multiple verbose lines 2020-11-23 14:21:51 +00:00
Ralf Habacker
4634d20ef1 Add verbose info to publishing session bus related functions
This is useful for tracking auto launch support in dbus-daemon.
2020-11-23 14:21:51 +00:00
Simon McVittie
c7ad138a21 Merge branch 'update-selinux-auditing' into 'master'
bus/selinux: Fix audit message types.

See merge request dbus/dbus!173
2020-11-23 13:23:12 +00:00
Chris PeBenito
2d5d40d5a5 bus/selinux: Fix audit message types.
The SELinux log callback includes a message type. Not all messages are
auditable and those that are have varying audit types. An audit message is
a security-relevant event: security state changes, MAC permission denied,
etc.  A message that is auditable is not necessarily sensitive.  Messages
that are not auditable are not security-relevant, like messages about
socket polling errors.  Update the auditing accordingly.

If the message is not auditable, fall through and write it to syslog.

Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
2020-11-23 13:07:19 +00:00
Simon McVittie
8e028f2002 Merge branch 'travis-ci-cleanup' into 'master'
Drop unused travis CI configuration files

See merge request dbus/dbus!197
2020-11-23 12:06:10 +00:00
Ralf Habacker
2534c2076f Drop unused travis CI configuration files 2020-11-16 14:48:59 +01:00
Simon McVittie
75a9cd0827 Merge branch 'bug/NEWS-machine-id-paths' into 'master'
NEWS: Add missing directory 'lib' to three paths

See merge request dbus/dbus!182
2020-11-09 15:00:39 +00:00
Samy Mahmoudi
95ad63d706 NEWS: Add missing directory 'lib' to three paths
Since ${localstatedir}/dbus should be ${localstatedir}/lib/dbus,
insert the missing directory 'lib' into the three erroneous paths.
2020-11-06 22:39:55 +00:00
Simon McVittie
b187a5f729 Merge branch 'macos-x11-bugfix' into 'master'
dbus-launch: Replace slashes in DISPLAY if present

Closes #8 and #311

See merge request dbus/dbus!180
2020-11-06 17:26:28 +00:00
William Earley
3545d0f4de dbus-launch: Replace slashes in DISPLAY if present
dbus-daemon fails to autolaunch with X11 on macOS 10.8+ because XQuartz
(the X11 package for macOS) provides a value for `$DISPLAY` that is
not expected by dbus, in that it contains `/` characters. This is
addressed by replacing the invalid path character `/` with `_`.

Resolves: #8
Resolves: #311
2020-11-06 17:17:09 +00:00
Simon McVittie
895ef72bc0 Merge branch 'macos-setrlimit-bugfix' into 'master'
sysdeps: Don't raise RLIMIT_NOFILE beyond OPEN_MAX on macOS

Closes #309

See merge request dbus/dbus!178
2020-11-06 15:20:51 +00:00
William Earley
691946dabc sysdeps: Don't raise RLIMIT_NOFILE beyond OPEN_MAX on macOS
dbus-daemon fails to launch on macOS 10.5 and above because of a breaking
change in setrlimit, in which RLIM_INFINITY is no longer supported
for RLIMIT_NOFILE. Instead we must use OPEN_MAX.

Resolves: #309
2020-11-06 15:10:42 +00:00
Simon McVittie
49d924ba56 Merge branch 'docs-generate-reproducible-ids' into 'master'
docs: generate reproducible ids

See merge request dbus/dbus!189
2020-11-06 14:01:46 +00:00
Arnout Engelen
43e0188dbf
docs: generate reproducible ids
With this parameter, docbook will generate the same id's when generating the
same docs. This is helpful to get bit-by-bit 'reproducible' output, which
makes auditing the package easier.

Tested both the cmake output and the automake output
2020-11-06 14:52:48 +01:00
Simon McVittie
5db5415810 Merge branch 'wip/update-msys-packages' into 'master'
ci-build: Update required MSYS packages

Closes #318

See merge request dbus/dbus!190
2020-11-06 13:51:17 +00:00
Simon McVittie
053238254e ci-build: Update required MSYS packages
The older versions we were previously building against are no longer
available on mirrors.

Based on changes proposed in !189 by Arnout Engelen, and the package
list gathered by Ralf Habacker in #318.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/318
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-11-06 13:38:45 +00:00
Simon McVittie
0686f7bb16 Merge branch 'patch-1' into 'master'
doc: Fix typo in dbus-daemon(1)

See merge request dbus/dbus!183
2020-10-19 19:49:03 +00:00
Chigozirim Chukwu
72dd2923d0 doc: Fix typo in dbus-daemon(1) 2020-10-19 18:38:09 +00:00
Simon McVittie
2285db23ce Merge branch 'glibc' into 'master'
disable fork-malloc-exec for non-glibc-systems

See merge request dbus/dbus!181
2020-09-28 13:42:55 +00:00
Jean-Louis Fuchs
3fab06d68f
disable fork-malloc-exec for non-glibc-systems
Calling malloc() after fork is undefined behaviour if the process is
multi-threaded. locks held by a thread on fork() will never be released.
malloc() is usally protected by a lock and can therefore deadlock. glibc
is known not to deadlock in this case.

This commit does not rule out other problems on glibc-systems, but fixes an
issue on musl-libc-systems. Only restricting to async-signal safe functions
between fork() and exec() prevents undefined behaviour for sure. See
signal-safety(7).
2020-09-28 15:18:12 +02:00
Simon McVittie
bf51a3169c Merge branch 'cmake-enable-traditional-activation' into 'master'
CMake: allow traditional activation to be disabled

See merge request dbus/dbus!159
2020-09-24 10:48:47 +00:00
Ralf Habacker
5b1870a5bd cmake: make support for traditional activation optional
Traditional activation is enabled/disabled with the cmake configure
parameter -DENABLE_TRADITIONAL_ACTIVATION, which is enabled by default.

This was added to the Autotools build system as part of dbus/dbus!107
but until now was not possible to disable when building with CMake.
2020-09-23 17:21:40 +02:00
Ralf Habacker
82942171a8 Merge branch 'cmake-fixup' into 'master'
cmake: move up checking DBUS_ENABLE_EMBEDDED_TESTS from subdir test/name-test to test

See merge request dbus/dbus!177
2020-09-23 15:02:08 +00:00
Ralf Habacker
b698fb7639 cmake: move up checking DBUS_ENABLE_EMBEDDED_TESTS from subdir test/name-test to test
The whole file is only added with the mentioned variable
set, so it can also be skipped completly one level up.
2020-09-23 14:27:53 +00:00
Simon McVittie
bc7123534d Merge branch 'install-ddlh' into 'master'
cmake: install dbus-daemon-launch-helper

Closes #310

See merge request dbus/dbus!175
2020-09-23 14:18:48 +00:00
Ralf Habacker
2148a5a803 cmake: install dbus-daemon-launch-helper on Unix
Previously it was built on Unix platforms, but not installed. This
would prevent traditional activation on the system bus (on Linux
without systemd or non-Linux, or for services without SystemdService),
which requires the activation helper.

Because the executable is an internal implementation detail of how
traditional activation is implemented on Unix, it is not exported to
the generated cmake support files.

Resolves: dbus#310
2020-09-22 11:22:40 +02:00
Simon McVittie
e8dc63c041 Merge branch 'spec-cookie-timeouts' into 'master'
spec: Update recommendations for DBUS_COOKIE_SHA1 timeouts

See merge request dbus/dbus!171
2020-09-21 11:23:25 +00:00
Simon McVittie
3f8b2ce52e spec: Update recommendations for DBUS_COOKIE_SHA1 timeouts
This had two issues that could damage interoperability.

First, the spec wording suggested that any cookie that had not been
deleted was suitable for use in authentication. However, this introduces
a race condition, which is called out in comments in both the reference
implementation and GDBus: the newest cookie might be less old than the
arbitrary lifetime when authentication *begins*, but older than the
lifetime at the time authentication *ends*. As a result, we need a grace
period during which an old cookie will still be accepted, but a newer
cookie exists and will be used for new authentication operations.

Second, the spec wording implied that the arbitrary timeouts were
completely up to the implementor. However, GLib bug
https://gitlab.gnome.org/GNOME/glib/-/issues/2164 indicates that they
need to be reasonably compatible: in particular, GDBus servers
historically didn't allocate new cookies until 10 minutes had passed,
but libdbus clients would decline to use a cookie older than 5 minutes,
causing authentication to fail if the gdbus-server test-case (in which
GDBus and libdbus clients connect to a GDBus server) happened to take
longer than 5 minutes to run.

While I'm here, also be consistent about calling the secrets "cookies"
(consistent with the name of the mechanism) rather than "keys" (which
is what they are called in libdbus' dbus-keyring.c).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-09-07 11:03:00 +00:00
Simon McVittie
58d71b797d Merge branch 'glib-tests-on-freebsd' into 'master'
tests: On Unix, include <netinet/in.h> for IPPROTO_TCP

See merge request dbus/dbus!167
2020-08-19 14:28:04 +00:00
Simon McVittie
f0e526bca8 tests: On Unix, include <netinet/in.h> for IPPROTO_TCP
Otherwise, dbus doesn't compile on FreeBSD if the GLib-based tests
are enabled (which suggests that no FreeBSD user has run those tests
successfully).

We already include <netinet/in.h> in other places with no conditions
or checks other than "is Unix", so apparently it's portable enough that
specifically testing for its presence is not necessary. POSIX requires it
to exist.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-08-14 17:02:46 +01:00
Simon McVittie
c91ca6edad v1.13.18
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-07-02 11:09:48 +01:00
Simon McVittie
00e7beaac2 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-07-02 10:24:55 +01:00
Simon McVittie
e75c67a28f Merge branch 'issue305' into 'master'
userdb: Reference-count DBusUserInfo, DBusGroupInfo

Closes #305

See merge request dbus/dbus!166
2020-07-01 13:29:39 +00:00
Simon McVittie
2b7948ef90 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>
2020-07-01 13:21:23 +01:00
Simon McVittie
6ee66ff7bc 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>
2020-06-30 19:13:17 +01:00
Simon McVittie
ce9682ecc3 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
2020-06-15 13:16:51 +00:00
Andy Fiddaman
b96ef23e40 Solaris and derivatives do not adjust cmsg_len on MSG_CTRUNC 2020-06-12 21:18:36 +00:00
Simon McVittie
18336ba46a Merge branch 'cmake-fix-install' into 'master'
cmake: Fix installed files

See merge request dbus/dbus!155
2020-06-10 18:22:48 +00:00
Ralf Habacker
927a5f4d75 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.
2020-06-10 18:13:47 +00:00
Ralf Habacker
97bdefd4e2 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.
2020-06-10 18:13:47 +00:00
Ralf Habacker
eb6d4a1439 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.
2020-06-10 18:13:47 +00:00
Ralf Habacker
ab404c5ffb cmake: rename tristateoption() to add_auto_option() and make signature compatible to option() 2020-06-10 18:13:47 +00:00
Ralf Habacker
3f3368b490 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
2020-06-10 18:13:47 +00:00
Ralf Habacker
d5fd3d76f7 cmake: fix installation of example files 2020-06-10 18:13:47 +00:00
Simon McVittie
f94696eb4f Merge branch 'normalize-trailing-newlines' into 'master'
Normalize C source files to end with exactly one newline

See merge request dbus/dbus!162
2020-06-10 10:56:26 +00:00
Simon McVittie
eeef787418 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>
2020-06-10 10:47:31 +00:00
Simon McVittie
55911d3ca9 Merge branch 'misc-comment' into 'master'
dbus-protocol.h: fix DBUS_ERROR_SPAWN_NO_MEMORY comment

See merge request dbus/dbus!163
2020-06-10 10:46:42 +00:00
Marc-André Lureau
a6454e4291 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>
2020-06-10 14:26:03 +04:00
Simon McVittie
41dfee5c32 Start 1.13.18 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-02 21:07:31 +01:00
Simon McVittie
fc2ee9f73b Prepare 1.13.16
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-06-02 12:18:05 +01:00