]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
13 months agoPrepare v1.15.10 dbus-1.15.10
Simon McVittie [Wed, 25 Sep 2024 13:19:13 +0000 (14:19 +0100)] 
Prepare v1.15.10

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agoUpdate NEWS
Simon McVittie [Wed, 25 Sep 2024 14:15:59 +0000 (15:15 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agoMerge branch 'gcc-14' into 'master'
Simon McVittie [Wed, 25 Sep 2024 14:12:46 +0000 (14:12 +0000)] 
Merge branch 'gcc-14' into 'master'

Fix compiler warnings/errors with gcc 14

See merge request dbus/dbus!469

13 months agotest: Always initialize an "out" parameter
Simon McVittie [Wed, 25 Sep 2024 13:41:48 +0000 (14:41 +0100)] 
test: Always initialize an "out" parameter

check_valid_fd() does not touch its second parameter if the fd is not,
in fact, a valid fd. Initialize the "out" parameter to the opposite
of the value we are hoping for, so that both assertions will fail if
there is a problem.

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agosysdeps-unix: Always initialize flags for syslog()
Simon McVittie [Wed, 25 Sep 2024 13:40:16 +0000 (14:40 +0100)] 
sysdeps-unix: Always initialize flags for syslog()

If passed an invalid DBusSystemLogSeverity, the default case for the
switch construct is to crash out with an assertion failure, but the
assertion failure itself is not compiled in if we are doing a production
build without assertions.

Detected by compiling with gcc 14, which does some static analysis
by default.

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agodbus-spam: Ensure that payload_len is always initialized
Simon McVittie [Wed, 25 Sep 2024 13:38:31 +0000 (14:38 +0100)] 
dbus-spam: Ensure that payload_len is always initialized

A command like `dbus-test-tool spam --payload=abcde --bytes` could
previously have left the length uninitialized.

Detected by compiling with gcc 14.

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agosysdeps: Avoid passing possibly null port-number string to printf %s
Simon McVittie [Wed, 25 Sep 2024 13:36:13 +0000 (14:36 +0100)] 
sysdeps: Avoid passing possibly null port-number string to printf %s

gcc 14 detects that port can be NULL here, which is technically invalid
to pass to printf (although many implementations print it as "(null)").
Becuase we're using getaddrinfo(), we treat a NULL service (port number
string) as a request to listen on "port 0", meaning we ask the kernel to
assign an arbitrary nonzero port for us; when printing addresses in
error messages, treating that as port 0 seems reasonable.

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agomaint: Remove leftover Autotools references
Simon McVittie [Wed, 25 Sep 2024 13:18:24 +0000 (14:18 +0100)] 
maint: Remove leftover Autotools references

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agoAUTHORS: Update
Simon McVittie [Wed, 25 Sep 2024 13:14:45 +0000 (14:14 +0100)] 
AUTHORS: Update

Signed-off-by: Simon McVittie <smcv@collabora.com>
13 months agoUpdate NEWS
Simon McVittie [Wed, 25 Sep 2024 12:16:51 +0000 (13:16 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
14 months agoMerge branch 'uid_t' into 'master'
Simon McVittie [Tue, 13 Aug 2024 15:34:06 +0000 (15:34 +0000)] 
Merge branch 'uid_t' into 'master'

dbus-sysdeps-unix: don't add (uid_t)-1 to creds

See merge request dbus/dbus!464

14 months agodbus-sysdeps-unix: don't add (uid_t)-1 to creds
Alyssa Ross [Mon, 22 Jul 2024 08:08:05 +0000 (10:08 +0200)] 
dbus-sysdeps-unix: don't add (uid_t)-1 to creds

If I set a breakpoint on the call to _dbus_credentials_add_unix_uid
further down in this function and run the loopback test, I can see
that sometimes it's getting called with a uid of 4294967295.  This is
not intended, but happens because the -1 value returned from
SO_PEERCRED is interpreted as a uid of 4294967295, because if uid_t is
unsigned, it won't be sign extended when assigned to uid_read.

As far as I can tell, every other API used in this function to get
uid/gid on some system returns an error when there's no credential
information (e.g. on a non-unix socket), rather than returning -1, so
they shouldn't have to do this check.

Fixes: 01af5ff4 ("add credentials support, add EXTERNAL auth mechanism")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
14 months agoMerge branch 'test-deps' into 'master'
Simon McVittie [Tue, 13 Aug 2024 15:10:59 +0000 (15:10 +0000)] 
Merge branch 'test-deps' into 'master'

test: add missing test dependencies

See merge request dbus/dbus!465

15 months agotest: add missing test dependencies
Alyssa Ross [Thu, 25 Jul 2024 08:49:50 +0000 (10:49 +0200)] 
test: add missing test dependencies

This fixes doing "meson setup" followed by "meson test", without doing
a full build in between.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
15 months agoMerge branch 'tty' into 'master'
Simon McVittie [Mon, 29 Jul 2024 12:21:02 +0000 (12:21 +0000)] 
Merge branch 'tty' into 'master'

test: use "tty" group rather than "bin"

Closes #514

See merge request dbus/dbus!466

15 months agotest: use "tty" group rather than "bin"
Alyssa Ross [Sun, 28 Jul 2024 10:50:37 +0000 (12:50 +0200)] 
test: use "tty" group rather than "bin"

Unlike "bin", "tty" actually means something on modern Linux distros,
and is used by a default udev rule, so it's more likely to exist on
distros than a group that just exists for historical compatibility
with who knows what.

"tty" exists on macOS, Debian, and Fedora (the criteria used for
choosing "bin" in f2905def ("policy tests: Use bin rather than
nogroup, wheel, or root")), but also fixes running the bus test for me
on NixOS, which has "tty" but not "bin".

Closes: https://gitlab.freedesktop.org/dbus/dbus/-/issues/514
Signed-off-by: Alyssa Ross <hi@alyssa.is>
15 months agoMerge branch 'macros' into 'master'
Simon McVittie [Thu, 25 Jul 2024 15:17:15 +0000 (15:17 +0000)] 
Merge branch 'macros' into 'master'

build: fix macro mistakes

See merge request dbus/dbus!463

15 months agomeson: fix name of DBUS_ENABLE_LAUNCHD macro
Alyssa Ross [Sun, 21 Jul 2024 12:24:13 +0000 (14:24 +0200)] 
meson: fix name of DBUS_ENABLE_LAUNCHD macro

This is the name used previously by autoconf, and still used by the C
code.  Presumably this meant that the launchd ended up never being
built with Meson, even if launchd support was enabled.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Fixes: cd2e3826 ("Add Meson build system")
15 months agobuild: remove unused macros
Alyssa Ross [Sun, 21 Jul 2024 12:22:44 +0000 (14:22 +0200)] 
build: remove unused macros

These were/are used as autoconf/CMake variable names, but were never
used by C code, so there's no need to export them as macros.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Fixes: dca6591f ("Keep cmake defines GLIB_VERSION_... in sync with autotools.")
Fixes: cd2e3826 ("Add Meson build system")
17 months agoMerge branch 'fix-dbus-send-manpage' into 'master'
Ralf Habacker [Mon, 27 May 2024 15:24:18 +0000 (15:24 +0000)] 
Merge branch 'fix-dbus-send-manpage' into 'master'

Document the return value of dbus-send tool.

Closes #452

See merge request dbus/dbus!397

17 months agoDocument the return value of dbus-send tool.
Philip Withnall [Mon, 27 May 2024 15:24:18 +0000 (15:24 +0000)] 
Document the return value of dbus-send tool.

17 months agoCI: Disable "debian mingw64 meson debug" until #509 is fixed
Ralf Habacker [Mon, 27 May 2024 14:34:50 +0000 (16:34 +0200)] 
CI: Disable "debian mingw64 meson debug" until #509 is fixed

See #509

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
17 months agoMerge branch 'string-int-append' into 'master'
Ralf Habacker [Sat, 18 May 2024 12:31:46 +0000 (12:31 +0000)] 
Merge branch 'string-int-append' into 'master'

sysdeps: Remove _dbus_string_append_int(), _uint()

See merge request dbus/dbus!445

17 months agosysdeps: Remove _dbus_string_append_int()
Simon McVittie [Wed, 23 Aug 2023 11:04:33 +0000 (12:04 +0100)] 
sysdeps: Remove _dbus_string_append_int()

It's a wrapper around snprintf(), so we are not gaining any efficiency
versus _dbus_string_append_printf(), and might as well use the more
general function instead. Doing it this way might even be a little *more*
efficient, since it reduces reallocations; it's certainly more concise.

Signed-off-by: Simon McVittie <smcv@collabora.com>
17 months agosysdeps: Remove _dbus_string_append_uint()
Simon McVittie [Wed, 23 Aug 2023 10:57:44 +0000 (11:57 +0100)] 
sysdeps: Remove _dbus_string_append_uint()

It's a wrapper around snprintf(), so we are not gaining any efficiency
versus _dbus_string_append_printf(), and might as well use the more
general function instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
17 months agoMerge branch 'document-send-with-reply' into 'master'
Ralf Habacker [Sat, 18 May 2024 12:00:02 +0000 (12:00 +0000)] 
Merge branch 'document-send-with-reply' into 'master'

Document ownership of reference in dbus_connection_send_with_reply()

See merge request dbus/dbus!455

17 months agoDocument ownership of reference in dbus_connection_send_with_reply()
Wiebe Cazemier [Mon, 19 Feb 2024 13:20:39 +0000 (14:20 +0100)] 
Document ownership of reference in dbus_connection_send_with_reply()

Signed-off-by: Wiebe Cazemier <wiebe@ytec.nl>
17 months agoMerge branch 'update_api_design_doc' into 'master'
Simon McVittie [Fri, 10 May 2024 10:49:57 +0000 (10:49 +0000)] 
Merge branch 'update_api_design_doc' into 'master'

doc/dbus-api-design: Update Bustle URL and replace deprecated D-Feet with d-spy

See merge request dbus/dbus!460

17 months agodoc/dbus-api-design: Replace D-Feet with d-spy
Ludovico de Nittis [Fri, 10 May 2024 10:07:09 +0000 (12:07 +0200)] 
doc/dbus-api-design: Replace D-Feet with d-spy

D-Feet is no longer maintained and its closest replacement, as mentioned
in the D-Feet page https://wiki.gnome.org/Apps/DFeet, is d-spy.

The project description doesn't need to be updated because d-spy
provides the same set of features that D-Feet had.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
17 months agodoc/dbus-api-design: Update Bustle URL
Ludovico de Nittis [Fri, 10 May 2024 10:02:13 +0000 (12:02 +0200)] 
doc/dbus-api-design: Update Bustle URL

gitlab.fd.o/bustle/bustle points to the old archived project. The new
version has been rewritten in Rust and is now hosted at
gitlab.gnome.org/World/bustle

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
18 months agoMerge branch 'cmake-fixes' into 'master'
Ralf Habacker [Wed, 17 Apr 2024 09:54:46 +0000 (09:54 +0000)] 
Merge branch 'cmake-fixes' into 'master'

cmake: complete installed files

Closes #504

See merge request dbus/dbus!459

18 months agocmake: Inclusion of a link in html overview file corrected
Ralf Habacker [Tue, 2 Apr 2024 10:53:29 +0000 (12:53 +0200)] 
cmake: Inclusion of a link in html overview file corrected

The link for api documentation is now only inserted into the html
overview file when it is built.

18 months agocmake: Add missing docbook-based documentation
Ralf Habacker [Tue, 2 Apr 2024 10:48:35 +0000 (12:48 +0200)] 
cmake: Add missing docbook-based documentation

With this commit, the html documentation for dbus-faq, dbus-specification,
dbus-test-plan, dbus-tutorial is now also created and installed.

18 months agoMerge branch 'autolaunch-regression' into 'master'
Ralf Habacker [Tue, 9 Apr 2024 06:27:52 +0000 (06:27 +0000)] 
Merge branch 'autolaunch-regression' into 'master'

sysdeps-win: Fix autolaunch: regression on Windows

Closes #503

See merge request dbus/dbus!458

19 months agosysdeps-win: Fix autolaunch: regression on Windows
Thomas Sondergaard [Sat, 6 Apr 2024 17:29:15 +0000 (19:29 +0200)] 
sysdeps-win: Fix autolaunch: regression on Windows

Commit f20a05f60f6f included in dbus-1.15.0 broke autolaunch: on
Windows. autolaunch_custom_command_line_parameter shall be initalized
to null as it is later used in only one place in the code, with this
ternary:

    autolaunch_custom_command_line_parameter ? autolaunch_custom_command_line_parameter : "--session"

Closes #503

21 months agoMerge branch 'master' into 'master'
Simon McVittie [Mon, 29 Jan 2024 13:54:19 +0000 (13:54 +0000)] 
Merge branch 'master' into 'master'

bus/dir-watch:Do not crash when reloading configuration with > 128 dirs

Closes #481

See merge request dbus/dbus!453

21 months agoDo not crash when reloading configuration with > 128 dirs
hongjinghao [Thu, 4 Jan 2024 07:15:53 +0000 (15:15 +0800)] 
Do not crash when reloading configuration with > 128 dirs

When `dbus-daemon` sets more than 128 directories for `XDG_DATA_DIRS`,
none of the elements in `new_dirs` will be `NULL`, which resulted in
these loops reading out-of-bounds (undefined behaviour). In practice
this led to a crash.

To avoid this, make sure to stop iteration at the end of the array.

[smcv: Expanded commit message]
Resolves: dbus/dbus#481

21 months agoMerge branch 'meson-visual-studio-2022' into 'master'
Simon McVittie [Mon, 15 Jan 2024 20:00:43 +0000 (20:00 +0000)] 
Merge branch 'meson-visual-studio-2022' into 'master'

meson: Use check_header to confirm headers work

Closes #494

See merge request dbus/dbus!454

22 months agomeson: Use check_header to confirm headers work
Thomas Sondergaard [Thu, 4 Jan 2024 16:45:46 +0000 (17:45 +0100)] 
meson: Use check_header to confirm headers work

instead of using has_header use check_header to confirm the header
works. This is necessary to get the meson build to work with Visual
Studio 2022. It has <stdatomic.h> but it does not actually work when
compiling a C program. A minimal C program that include <stdatomic.h>
fails with the following errors:

    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(36): error C2061: syntax error: identifier 'atomic_bool'
    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(36): error C2059: syntax error: ';'
    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(37): error C2061: syntax error: identifier 'atomic_char'
    C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\include\vcruntime_c11_stdatomic.h(37): error C2059: syntax error: ';'
    ...
    ...

check_header is consistent with CMake's

    check_include_file(stdatomic.h  HAVE_STDATOMIC_H)

which is why the CMake-based build of dbus works with Visual Studio
2022, while the meson build doesn't.

Fixes #494

23 months agoMerge branch 'issue489' into 'master'
Ralf Habacker [Fri, 1 Dec 2023 21:45:18 +0000 (21:45 +0000)] 
Merge branch 'issue489' into 'master'

CI: Fix more test failures

Closes #489 and #488

See merge request dbus/dbus!452

23 months agoCI: Set language environment variables to safe values
Simon McVittie [Fri, 1 Dec 2023 19:10:50 +0000 (19:10 +0000)] 
CI: Set language environment variables to safe values

Recent versions of glibc support C.UTF-8 natively, and both Debian and
openSUSE (which we use for our CI) have been patching it into our glibc
versions for several years before that.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/488
Signed-off-by: Simon McVittie <smcv@collabora.com>
23 months agoCI: Don't re-run the tests when preparing to build as a subproject
Simon McVittie [Fri, 1 Dec 2023 19:03:49 +0000 (19:03 +0000)] 
CI: Don't re-run the tests when preparing to build as a subproject

After running the test suite, we don't need (or want) to re-run the test
suite as a side-effect of producing a dist tarball. Historically, this
test-case used Autotools `make dist`, not `make distcheck`, but when
we removed the Autotools build system, it was replaced with
`meson dist` (similar to Autotools `make distcheck`). Change that to
`meson dist --no-tests`, which is more like Autotools `make dist` as
originally intended.

In particular, when we re-ran the test suite, we weren't filtering out
the time-consuming and timeout-prone tests that emulate malloc()
failures, which we don't normally intend to run in CI.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/489
Signed-off-by: Simon McVittie <smcv@collabora.com>
23 months agoCI: Remove meson-dist and cmake-dist build systems
Simon McVittie [Fri, 1 Dec 2023 19:00:20 +0000 (19:00 +0000)] 
CI: Remove meson-dist and cmake-dist build systems

Before we removed the Autotools build system, these meant: do a
`make dist` with Autotools, then unpack the resulting tarball, and build
it with Meson or CMake (as appropriate). This was important because the
contents of an Autotools `make dist` differed significantly from what's
in git: only the files that were explicitly declared as sources in the
Autotools build system were distributed, and Autotools would also add its
own generated cruft.

Now that we're doing releases with Meson, the official source release
artifact is basically `git archive`, so there's much less need to
distinguish between official source releases and what's in git, and these
variant build systems became simple aliases for meson and cmake.
Remove those aliases from tools/ci-build.sh, and stop using them in
.gitlab-ci.yml.

Signed-off-by: Simon McVittie <smcv@collabora.com>
23 months agoMerge branch 'fix-ci-build' into 'master'
Simon McVittie [Fri, 1 Dec 2023 18:09:05 +0000 (18:09 +0000)] 
Merge branch 'fix-ci-build' into 'master'

CI: force update opensuse image to a newer version

Closes #487

See merge request dbus/dbus!451

23 months agoCI: on openSUSE use cmake from the windows:mingw project instead from devel:tools...
Ralf Habacker [Fri, 1 Dec 2023 16:18:01 +0000 (17:18 +0100)] 
CI: on openSUSE use cmake from the windows:mingw project instead from devel:tools:building

Since this repo is already used for mingw builds, the additional repo and
associated problems can be avoided.

23 months agoCI: add hint when to update the build images
Ralf Habacker [Fri, 1 Dec 2023 15:51:54 +0000 (16:51 +0100)] 
CI: add hint when to update the build images

23 months agoCI: force update opensuse image to a newer version
Ralf Habacker [Fri, 1 Dec 2023 15:44:07 +0000 (16:44 +0100)] 
CI: force update opensuse image to a newer version

Since a time-frozen image is used in the CI, the tag must be changed to
update to a newer minor version.

Fixes #487

2 years agoUpdate NEWS
Simon McVittie [Fri, 1 Sep 2023 16:26:54 +0000 (17:26 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'remove-autotools-support' into 'master'
Simon McVittie [Fri, 1 Sep 2023 16:06:10 +0000 (16:06 +0000)] 
Merge branch 'remove-autotools-support' into 'master'

Remove autotools build support

Closes #443

See merge request dbus/dbus!378

2 years agoREADME,INSTALL: remove references to the autotools build system
Ralf Habacker [Mon, 21 Aug 2023 21:35:58 +0000 (23:35 +0200)] 
README,INSTALL: remove references to the autotools build system

2 years ago.gitignore: remove autotools related files and pattern
Ralf Habacker [Mon, 2 Jan 2023 15:45:21 +0000 (16:45 +0100)] 
.gitignore: remove autotools related files and pattern

2 years agoRemove autotools related files
Ralf Habacker [Mon, 21 Aug 2023 21:34:51 +0000 (23:34 +0200)] 
Remove autotools related files

2 years agoRemove autotools support from CI jobs
Ralf Habacker [Mon, 21 Aug 2023 21:34:10 +0000 (23:34 +0200)] 
Remove autotools support from CI jobs

The 'debian mingw32 autotools debug' job was replaced with a corresponding
meson related job named 'debian mingw32 meson debug' and the remaining
autotools related jobs were removed.

The drop in replacement job for 'debian mingw64 autotools' is
'debian mingw32 meson' and is now build by default.

2 years agoMerge branch 'fix-y2038' into 'master'
Simon McVittie [Thu, 24 Aug 2023 13:13:37 +0000 (13:13 +0000)] 
Merge branch 'fix-y2038' into 'master'

time: use dbus_int64_t for seconds instead of long

See merge request dbus/dbus!444

2 years agotime: use dbus_int64_t for seconds instead of long
Alexander Kanavin [Tue, 22 Aug 2023 12:02:16 +0000 (14:02 +0200)] 
time: use dbus_int64_t for seconds instead of long

On 32 bit systems long will overflow in 2038, causing complete breakage.
This is confirmed by running dbus's test suite on a 32 bit system
with system time set to 2040 (and configured to use 64 bit time_t of course).

Note that both timespec and timeval are specified with time_t for the
seconds component. This should propagate everywhere where that data is
passed and stored, but previously _dbus_get_monotonic_time() and
_dbus_get_monotonic_time() would truncate it to long.

Also add a function for parsing dbus_int64_t from
files, as existing functions can only handle long.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2 years agoStart 1.15.10 development
Simon McVittie [Mon, 21 Aug 2023 19:53:07 +0000 (20:53 +0100)] 
Start 1.15.10 development

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoPrepare v1.15.8 dbus-1.15.8
Simon McVittie [Mon, 21 Aug 2023 17:17:15 +0000 (18:17 +0100)] 
Prepare v1.15.8

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoAUTHORS: Update
Simon McVittie [Mon, 21 Aug 2023 17:18:22 +0000 (18:18 +0100)] 
AUTHORS: Update

Automated change:

    ninja -C ${builddir} maintainer-update-authors

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoUpdate NEWS
Simon McVittie [Mon, 21 Aug 2023 16:55:00 +0000 (17:55 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'issue343-3' into 'master'
Simon McVittie [Mon, 21 Aug 2023 16:50:06 +0000 (16:50 +0000)] 
Merge branch 'issue343-3' into 'master'

sysdeps: Improve error reporting for looking up a user

See merge request dbus/dbus!442

2 years agouserdb: Use "goto out" pattern for _dbus_groups_from_uid()
Simon McVittie [Thu, 29 Jun 2023 16:51:48 +0000 (17:51 +0100)] 
userdb: Use "goto out" pattern for _dbus_groups_from_uid()

This makes it easier to verify that _dbus_user_database_unlock_system()
is called on all exit paths. The only early-return is when locking the
userdb failed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agosysdeps: Improve error reporting for looking up a user
Simon McVittie [Thu, 29 Jun 2023 16:28:40 +0000 (17:28 +0100)] 
sysdeps: Improve error reporting for looking up a user

Our implementation always assumed that both code paths set errno, but
according to their API documentation, getpwnam_r and getpwuid_r actually
don't: they *return* a code from the same pseudo-enum as errno. They
also return 0 (but with a NULL struct passwd) if the user is not found,
which these APIs don't count as an error (but we do).

Similarly, in the legacy getpwnam/getpwuid code path, it is unspecified
whether looking up a nonexistent user will set errno or not.

Having retrieved an errno-like error code, we might as well use it in
the human-readable message and not just the machine-readable code,
because the human-readable message is what ends up in the system log.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agosysdeps: Give a more useful error if unable to resolve a numeric uid
Simon McVittie [Thu, 29 Jun 2023 16:03:51 +0000 (17:03 +0100)] 
sysdeps: Give a more useful error if unable to resolve a numeric uid

If we want to get the struct passwd corresponding to uid 42, but we
can't, it's much better to say

    User ID "42" unknown

rather than

    User "???" unknown

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agosysdeps-unix: Deduplicate error handling for getpwnam and getpwnam_r
Simon McVittie [Thu, 29 Jun 2023 16:00:58 +0000 (17:00 +0100)] 
sysdeps-unix: Deduplicate error handling for getpwnam and getpwnam_r

The only difference between these was that we only needed to allocate
and free buf in the getpwnam_r case. We expect that all reasonable
Unix platforms will have getpwnam_r (it's in POSIX) so adding a no-op
dbus_free(NULL) to the getpwnam code path seems harmless.

This will be helpful when we make the error handling better, in a
subsequent commit.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'issue473' into 'master'
Simon McVittie [Mon, 21 Aug 2023 13:49:14 +0000 (13:49 +0000)] 
Merge branch 'issue473' into 'master'

bus: Don't crash if inotify fails, even under DBUS_FATAL_WARNINGS=1

Closes #473

See merge request dbus/dbus!441

2 years agobus: Don't crash if inotify fails, even under DBUS_FATAL_WARNINGS=1
Simon McVittie [Fri, 18 Aug 2023 16:15:32 +0000 (17:15 +0100)] 
bus: Don't crash if inotify fails, even under DBUS_FATAL_WARNINGS=1

When running tests, we use DBUS_FATAL_WARNINGS=1 to make the tests fail
on internal errors. Failing to set up inotify is not really an internal
error: it's more like an environmental error, which can occur for
reasons outside our control.

Instead, log using bus_context_log(), which never crashes the process
and always just logs a warning.

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

2 years agoUpdate NEWS
Simon McVittie [Fri, 18 Aug 2023 18:55:59 +0000 (19:55 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'issue343' into 'master'
Simon McVittie [Fri, 18 Aug 2023 18:33:55 +0000 (18:33 +0000)] 
Merge branch 'issue343' into 'master'

Fix error behaviour on reload if a connection has an unknown uid

See merge request dbus/dbus!417

2 years agobus: When failing to reload client policy, continue iteration
Simon McVittie [Thu, 29 Jun 2023 18:52:39 +0000 (19:52 +0100)] 
bus: When failing to reload client policy, continue iteration

If we have a large number of connections to the bus, and we fail to
reload the policy for one of them (perhaps because its uid no longer
exists in the system user database), previously we would crash, which
is obviously unintended. After the previous commit, we would stop
iteration through the list of client connections, which doesn't seem
great either: one bad connection shouldn't prevent us from reloading
the rest of our state.

Instead, let's distinguish between new connections (where we want
failure to establish a security policy to be fatal), and pre-existing
connections (where the current security policy is presumably good
enough to keep using if we have nothing better). If we're unable to
reload the policy for a pre-existing connection, log a warning and
carry on iterating.

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agotest: Add a targeted test for _dbus_unix_groups_from_uid()
Simon McVittie [Thu, 29 Jun 2023 15:54:46 +0000 (16:54 +0100)] 
test: Add a targeted test for _dbus_unix_groups_from_uid()

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agouserdb: Add proper error reporting when getting groups from a uid
Simon McVittie [Thu, 29 Jun 2023 15:06:39 +0000 (16:06 +0100)] 
userdb: Add proper error reporting when getting groups from a uid

Previously, if dbus_connection_get_unix_user() succeeded but
_dbus_unix_groups_from_uid() failed, then bus_connection_get_unix_groups()
would incorrectly fail without setting the error indicator, resulting
in "(null)" being logged, which is rather unhelpful.

This also lets us distinguish between ENOMEM and other errors, such as
the uid not existing in the system's user database.

Fixes: 145fb99b (untitled refactoring commit, 2006-12-12)
Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'issue343-minimal' into 'master'
Simon McVittie [Fri, 18 Aug 2023 14:55:32 +0000 (14:55 +0000)] 
Merge branch 'issue343-minimal' into 'master'

bus: Don't crash if bus_context_create_client_policy() fails

Closes #343

See merge request dbus/dbus!435

2 years agobus: Don't crash if bus_context_create_client_policy() fails
Peter Benie [Fri, 23 Jun 2023 10:51:00 +0000 (11:51 +0100)] 
bus: Don't crash if bus_context_create_client_policy() fails

If policy creation fails, we can't usefully leave a NULL policy in the
BusConnectionData. If we did, the next attempt to reload policy would
crash with a NULL dereference when we tried to unref it, or with
an assertion failure.

One situation in which we can legitimately fail to create a client policy
is an out-of-memory condition. Another is if we are unable to look up a
connection's supplementary groups with SO_PEERGROUPS, and also unable to
look up the connection's uid's groups in the system user database, for
example because it belongs to a user account that has been deleted (which
is sysadmin error, but can happen, particularly in automated test systems)
or because a service required by a Name Service Switch plugin has failed.

Keeping the last known policy is consistent with what happens to all
the connections that are after this one in iteration order: after we
early-return, all of those connections retain their previous policies
(which doesn't seem ideal either, but that's how this has always worked).

[smcv: Add commit message]
Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/343

2 years agoUpdate NEWS
Simon McVittie [Tue, 15 Aug 2023 14:45:54 +0000 (15:45 +0100)] 
Update NEWS

2 years agoAdd REUSE copyright/license information for binary message blobs
Simon McVittie [Tue, 15 Aug 2023 14:37:37 +0000 (15:37 +0100)] 
Add REUSE copyright/license information for binary message blobs

Most of these binary blobs is mechanically derived from the
corresponding .hex file, which is hand-written.

boolean-has-no-value.message-raw is presumably either hand-constructed
or fuzzer-generated: it was committed by a Red Hat employee and never
altered, so I've assumed Red Hat is the copyright holder. Permission
was already granted by Red Hat to relicense their dbus contributions
under the MIT (Expat) license.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agosubprojects: Move SPDX information from inline to .reuse/dep5
Simon McVittie [Mon, 14 Aug 2023 15:38:10 +0000 (16:38 +0100)] 
subprojects: Move SPDX information from inline to .reuse/dep5

This makes updates with `meson wrap update` more straightforward.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'issue439' into 'master'
Simon McVittie [Tue, 15 Aug 2023 14:27:34 +0000 (14:27 +0000)] 
Merge branch 'issue439' into 'master'

meson: Specify that build-machine compiler for C++ is not required

Closes #439

See merge request dbus/dbus!432

2 years agomeson: Specify that build-machine compiler for C++ is not required
Simon McVittie [Mon, 14 Aug 2023 19:32:03 +0000 (20:32 +0100)] 
meson: Specify that build-machine compiler for C++ is not required

When cross-compiling Windows binaries on (for example) Linux, we only
need a Windows C++ compiler and not a Linux C++ compiler.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/439
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'stdatomic' into 'master'
Simon McVittie [Tue, 15 Aug 2023 13:34:10 +0000 (13:34 +0000)] 
Merge branch 'stdatomic' into 'master'

sysdeps: Use C11 stdatomic.h where possible

See merge request dbus/dbus!431

2 years agosysdeps: Use C11 stdatomic.h where possible
Simon McVittie [Mon, 14 Aug 2023 18:53:11 +0000 (19:53 +0100)] 
sysdeps: Use C11 stdatomic.h where possible

On Unix, dbus has historically used gcc-specific lock-free atomic
intrinsics where available, falling back to a pthreads mutex where
possible. Meanwhile, on Windows, it has historically used
InterlockedIncrement() and similar library functions (in practice
wrappers around lock-free intrinsics on real Windows, but IPC calls into
wineserver on Wine).

ISO C11 provides a new header, stdatomic.h, with standardized support
for atomic operations. Exactly how these are implemented is a compiler
quality-of-implementation decision, but any reasonable compiler
implementation on a modern CPU should be using intrinsics. Let's use
this wherever possible, falling back to our old implementation only if
the C11 implementation is unsupported.

One concrete benefit that we get from this is that when compiling with
mingw-w64 gcc and running via Wine, this makes atomic reference counting
operations into a simple local operation, rather than IPC to wineserver
which can be very slow. This should make our CI tests considerably more
reliable.

In all vaguely modern gcc versions (gcc 5.5 or later) and in contemporary
versions of clang, the default compiler mode is C11 or later with GNU
extensions. We intentionally do not ask for any specific C standard, so
we can use C11 features like this one, as long as we do so conditionally.

The Microsoft Visual C compiler does not currently support this without
special options, so we still use the Interlocked family of functions
when compiling for Windows with MSVC.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agosysdeps: Move declarations used from C++ to their own header
Simon McVittie [Tue, 15 Aug 2023 11:50:19 +0000 (12:50 +0100)] 
sysdeps: Move declarations used from C++ to their own header

I want to use <stdatomic.h> in dbus-sysdeps.h, but if we do that, we
won't be able to include that header into C++ code on all compilers.
Move the declarations for new internal Windows-specific functions
introduced in commit 17a23d08
"dbus_threads_init_default, dbus_threads_init: be safe to call at any time"
into their own header.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'as-installed' into 'master'
Simon McVittie [Tue, 15 Aug 2023 12:27:52 +0000 (12:27 +0000)] 
Merge branch 'as-installed' into 'master'

CI: Run "as-installed" tests with Meson, not just Autotools

Closes #436 and #470

See merge request dbus/dbus!425

2 years agoCI: Install systemd system and user units into our ${prefix}
Simon McVittie [Tue, 8 Aug 2023 11:07:09 +0000 (12:07 +0100)] 
CI: Install systemd system and user units into our ${prefix}

This keeps everything we install from CI separate from a possible
OS-level installation in /usr.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/470
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Run "as-installed" tests with Meson, not just Autotools
Simon McVittie [Mon, 7 Aug 2023 19:16:57 +0000 (20:16 +0100)] 
CI: Run "as-installed" tests with Meson, not just Autotools

Otherwise, we'd lose this test coverage when we remove Autotools.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/436
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agomeson: Allow `sudo meson install`, which doesn't set `DESTDIR`
Simon McVittie [Tue, 8 Aug 2023 11:02:51 +0000 (12:02 +0100)] 
meson: Allow `sudo meson install`, which doesn't set `DESTDIR`

This is generally not recommended (dbus should usually be installed from
the OS distributor's packages, which should install into a staging
directory using `DESTDIR`), but we'll want to use it in Gitlab-CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoINSTALL: Add some sub-headings for non-Meson build systems
Simon McVittie [Tue, 15 Aug 2023 12:10:37 +0000 (13:10 +0100)] 
INSTALL: Add some sub-headings for non-Meson build systems

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoINSTALL: Re-word CMake build instructions
Ralf Habacker [Tue, 15 Aug 2023 12:09:21 +0000 (13:09 +0100)] 
INSTALL: Re-word CMake build instructions

Originally part of commit
"README,INSTALL: remove references to the autotools build system"
in dbus!378.

Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoContinue to recommend CMake when building on Windows
Simon McVittie [Tue, 15 Aug 2023 12:06:18 +0000 (13:06 +0100)] 
Continue to recommend CMake when building on Windows

In the longer term I'd like to move everything towards Meson so we only
have one primary build system, but at the moment Ralf would prefer to
keep recommending CMake for Windows builds (see dbus!378) so let's
stick with that for now.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'spdx-mit' into 'master'
Simon McVittie [Tue, 15 Aug 2023 11:22:54 +0000 (11:22 +0000)] 
Merge branch 'spdx-mit' into 'master'

Add SPDX license tags for the MIT (Expat) license, where straightforward

See merge request dbus/dbus!427

2 years agoAdd SPDX license tags for the MIT (Expat) license, where straightforward
Simon McVittie [Mon, 14 Aug 2023 15:53:55 +0000 (16:53 +0100)] 
Add SPDX license tags for the MIT (Expat) license, where straightforward

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'meson-special-builds' into 'master'
Simon McVittie [Mon, 14 Aug 2023 17:17:29 +0000 (17:17 +0000)] 
Merge branch 'meson-special-builds' into 'master'

Use Meson for the 'reduced' and 'legacy' build variants

See merge request dbus/dbus!430

2 years agoUse Meson for the 'reduced' and 'legacy' build variants
Ralf Habacker [Tue, 8 Aug 2023 17:39:49 +0000 (19:39 +0200)] 
Use Meson for the 'reduced' and 'legacy' build variants

There are some differences between Autotools and Meson here:

- Because we detect native atomic operations differently, we can no
  longer emulate a platform that doesn't have them, such as ARMv4;
  but modern OSs no longer support ARMv4 and all significant hardware
  platforms now have native atomic operations, so this is now less of
  a concern.

- Similarly, we can no longer emulate a platform that doesn't have the
  getrandom() library function, but that function is available in all
  relevant glibc versions (such as CentOS >= 8, Debian >= 10,
  Ubuntu >= 18.04) so testing the fallback path is less of a concern now.

We also no longer try to disable dnotify in the legacy build, but our
dnotify code path was removed in 2013, so --disable-dnotify didn't do
anything anyway.

[Separated from a larger commit on dbus!378 â€”smcv]

Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'spdx-misc' into 'master'
Simon McVittie [Mon, 14 Aug 2023 16:21:35 +0000 (16:21 +0000)] 
Merge branch 'spdx-misc' into 'master'

Improve SPDX license info slightly

See merge request dbus/dbus!428

2 years agostats.h: Add missing copyright information
Simon McVittie [Mon, 14 Aug 2023 15:56:07 +0000 (16:56 +0100)] 
stats.h: Add missing copyright information

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agodoc: Repeat a copyright notice in a form understood by SPDX tools
Simon McVittie [Mon, 14 Aug 2023 15:54:13 +0000 (16:54 +0100)] 
doc: Repeat a copyright notice in a form understood by SPDX tools

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoNEWS: Update
Simon McVittie [Mon, 14 Aug 2023 15:29:33 +0000 (16:29 +0100)] 
NEWS: Update

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoINSTALL: Rewrite extremely outdated list of dependencies
Simon McVittie [Mon, 14 Aug 2023 15:29:24 +0000 (16:29 +0100)] 
INSTALL: Rewrite extremely outdated list of dependencies

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agorelease-checklist: Update for increased use of Meson
Simon McVittie [Mon, 14 Aug 2023 15:18:58 +0000 (16:18 +0100)] 
release-checklist: Update for increased use of Meson

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoINSTALL: Remove generic Autotools installation instructions
Simon McVittie [Mon, 14 Aug 2023 15:18:39 +0000 (16:18 +0100)] 
INSTALL: Remove generic Autotools installation instructions

Now that we are recommending Meson, let's de-emphasize Autotools.
Anyone who still needs Autotools will already know how it works, at
least generically.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoREADME, INSTALL: Move build/install instructions into INSTALL
Simon McVittie [Mon, 14 Aug 2023 15:17:46 +0000 (16:17 +0100)] 
README, INSTALL: Move build/install instructions into INSTALL

Signed-off-by: Simon McVittie <smcv@collabora.com>