]> git.ipfire.org Git - thirdparty/dbus.git/log
thirdparty/dbus.git
2 years agoMerge branch 'empty-group-list' into 'master'
Simon McVittie [Tue, 1 Aug 2023 18:23:09 +0000 (18:23 +0000)] 
Merge branch 'empty-group-list' into 'master'

dbus-sysdeps-unix: Handle empty supplementary group list

See merge request dbus/dbus!422

2 years agodbus-sysdeps-unix: Check socklen_t is unsigned when getting group list
cptpcrd [Mon, 31 Jul 2023 23:33:33 +0000 (19:33 -0400)] 
dbus-sysdeps-unix: Check socklen_t is unsigned when getting group list

After the change to handle an empty list properly, the function now
assumes that is true.

2 years agodbus-sysdeps-unix: Handle empty supplementary group list
cptpcrd [Sun, 30 Jul 2023 22:38:22 +0000 (18:38 -0400)] 
dbus-sysdeps-unix: Handle empty supplementary group list

It is valid for getsockopt(SO_PEERGROUPS) to return len=0; that
indicates the process has no supplementary groups. Rather than failing,
simply use the returned empty list (and add the primary GID to it).

Without this change, calling GetConnectionCredentials on a bus name
owned by a process with no supplementary groups does not return the
UnixGroupIDs field, even though it is easy to determine that the process
only has one GID (the primary GID).

2 years agoMerge branch 'adduser' into 'master'
Simon McVittie [Tue, 1 Aug 2023 18:02:33 +0000 (18:02 +0000)] 
Merge branch 'adduser' into 'master'

Fix CI failures

Closes #468

See merge request dbus/dbus!423

2 years agoCI: Only run "opensuse mingw64 meson debug" if triggered manually
Simon McVittie [Tue, 1 Aug 2023 17:48:30 +0000 (18:48 +0100)] 
CI: Only run "opensuse mingw64 meson debug" if triggered manually

Mitigates: dbus/dbus#469
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Make user creation idempotent
Simon McVittie [Tue, 1 Aug 2023 17:30:14 +0000 (18:30 +0100)] 
CI: Make user creation idempotent

adduser --system exits successfully if the user already exists, but
ordinary adduser doesn't.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/468
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'override_dep_name' into 'master'
Simon McVittie [Tue, 13 Jun 2023 18:53:14 +0000 (18:53 +0000)] 
Merge branch 'override_dep_name' into 'master'

meson: Override "dbus-1" dependency name

See merge request dbus/dbus!415

2 years agomeson: Override "dbus-1" dependency name
Barnabás Pőcze [Tue, 13 Jun 2023 16:12:26 +0000 (18:12 +0200)] 
meson: Override "dbus-1" dependency name

Since meson 0.54.0, it is possible to override a dependency name,
so do that to make it easy to use dbus as a subproject. After this
change, simply

  dependency('dbus-1')

will fall back to the subproject automatically and there is no need
for using `fallback` keyword argument. Of course this assumes that
the dbus source tree is at subprojects/dbus-1 and not subprojects/dbus
but it is easy to achieve that.

If the dbus source tree for some reason needs to be at subprojects/dbus,

  dependency('dbus-1', fallback: 'dbus')

may be used, which still has the advantage of not needing to
depend on the variable names in the dbus build definitions.

2 years agoMerge branch 'wip/work-around-462' into 'master'
Simon McVittie [Tue, 13 Jun 2023 13:16:30 +0000 (13:16 +0000)] 
Merge branch 'wip/work-around-462' into 'master'

CI: Don't run windows-meson-mingw-ucrt64 by default

See merge request dbus/dbus!414

2 years agoCI: Enable "debian mingw64 meson debug" by default
Simon McVittie [Tue, 13 Jun 2023 12:59:21 +0000 (13:59 +0100)] 
CI: Enable "debian mingw64 meson debug" by default

This gives us coverage for Meson mingw-w64 by default, but
cross-compiling from Debian with MSVCRT rather than a native compilation
on Windows with UCRT. When combined with "windows msys64 ucrt64 cmake",
this fills in most of the missing coverage caused by disabling
windows-meson-mingw-ucrt64 to work around dbus#462.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Don't run windows-meson-mingw-ucrt64 by default
Simon McVittie [Tue, 13 Jun 2023 12:57:25 +0000 (13:57 +0100)] 
CI: Don't run windows-meson-mingw-ucrt64 by default

Workaround for dbus#462: if this doesn't run reliably as a result of
external factors, then we shouldn't be using it as a CI gate.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'issue-455' into 'master'
Simon McVittie [Tue, 13 Jun 2023 11:58:07 +0000 (11:58 +0000)] 
Merge branch 'issue-455' into 'master'

CI: Fix problem with configuration when cross building with cmake

Closes #455

See merge request dbus/dbus!413

2 years agoCI: restore cross building with cmake
Ralf Habacker [Mon, 12 Jun 2023 19:35:32 +0000 (21:35 +0200)] 
CI: restore cross building with cmake

2 years agoCI: Fix problem with configuration when cross building with cmake
Ralf Habacker [Mon, 12 Jun 2023 17:55:05 +0000 (19:55 +0200)] 
CI: Fix problem with configuration when cross building with cmake

Due to an adaptation of an rpm macro for cross-compiling with cmake, there
was a problem with the previous method of using the current directory as
the build directory. Instead, the command line options provided by cmake
are now used to define the source and build directories, which provide more
stable behavior.

Fix #455

2 years agoMerge branch 'wip/meson-warnings' into 'master'
Simon McVittie [Wed, 7 Jun 2023 12:26:30 +0000 (12:26 +0000)] 
Merge branch 'wip/meson-warnings' into 'master'

meson: Disable some warnings when asserts/checks are disabled

See merge request dbus/dbus!412

2 years agomeson: Disable some warnings when asserts/checks are disabled 412/head
Simon McVittie [Tue, 6 Jun 2023 12:07:04 +0000 (13:07 +0100)] 
meson: Disable some warnings when asserts/checks are disabled

Some labels are only used when checks are enabled, and some variables
are only used when assertions and/or checks are enabled. Instead of
cluttering the code with extra #ifdefs, we silence those warnings:
they're harmless in this case. We already do this in Autotools.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'wip/issue453' into 'master'
Simon McVittie [Wed, 7 Jun 2023 12:08:04 +0000 (12:08 +0000)] 
Merge branch 'wip/issue453' into 'master'

cmake: Define _GNU_SOURCE before checking for any symbols

Closes #453

See merge request dbus/dbus!411

2 years agosysdeps: Correct fallback signature of Linux close_range() 411/head
Simon McVittie [Tue, 6 Jun 2023 12:05:41 +0000 (13:05 +0100)] 
sysdeps: Correct fallback signature of Linux close_range()

Linux generally declares syscalls with flags as type int. It's the same
ABI, but a slightly different API, and it seems better for our fallback
definition to match it exactly.

Related to dbus/dbus#453.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agocmake: Define _GNU_SOURCE before checking for any symbols
Simon McVittie [Tue, 6 Jun 2023 12:33:00 +0000 (13:33 +0100)] 
cmake: Define _GNU_SOURCE before checking for any symbols

Some of the symbols we check for, such as close_range(), are only
declared in their corresponding header files if _GNU_SOURCE was
defined.

Resolves: dbus/dbus#453
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoRelease v1.15.6 dbus-1.15.6
Simon McVittie [Tue, 6 Jun 2023 12:59:52 +0000 (13:59 +0100)] 
Release v1.15.6

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoAUTHORS: Update
Simon McVittie [Tue, 6 Jun 2023 12:47:38 +0000 (13:47 +0100)] 
AUTHORS: Update

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoUpdate NEWS
Simon McVittie [Tue, 6 Jun 2023 09:48:03 +0000 (10:48 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agomonitor test: Reproduce dbus/dbus#457
Simon McVittie [Mon, 5 Jun 2023 17:51:22 +0000 (18:51 +0100)] 
monitor test: Reproduce dbus/dbus#457

The exact failure mode reported in dbus/dbus#457 is quite difficult
to achieve in a reliable way in a unit test, because we'd have to send
enough messages to a client to fill up its queue, then stop that client
from draining its queue, while still triggering a message that gets a
reply from the bus driver. However, we can trigger the same crash in a
slightly different way by not allowing the client to receive a
particular message. I chose NameAcquired.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agobus: Assign a serial number for messages from the driver
hongjinghao [Mon, 5 Jun 2023 17:17:06 +0000 (18:17 +0100)] 
bus: Assign a serial number for messages from the driver

Normally, it's enough to rely on a message being given a serial number
by the DBusConnection just before it is actually sent. However, in the
rare case where the policy blocks the driver from sending a message
(due to a deny rule or the outgoing message quota being full), we need
to get a valid serial number sooner, so that we can copy it into the
DBUS_HEADER_FIELD_REPLY_SERIAL field (which is mandatory) in the error
message sent to monitors. Otherwise, the dbus-daemon will crash with
an assertion failure if at least one Monitoring client is attached,
because zero is not a valid serial number to copy.

This fixes a denial-of-service vulnerability: if a privileged user is
monitoring the well-known system bus using a Monitoring client like
dbus-monitor or `busctl monitor`, then an unprivileged user can cause
denial-of-service by triggering this crash. A mitigation for this
vulnerability is to avoid attaching Monitoring clients to the system
bus when they are not needed. If there are no Monitoring clients, then
the vulnerable code is not reached.

Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: dbus/dbus#457

2 years agomonitor test: Log the messages that we monitored
Simon McVittie [Mon, 5 Jun 2023 16:56:33 +0000 (17:56 +0100)] 
monitor test: Log the messages that we monitored

This is helpful while debugging test failures.

Helps: dbus/dbus#457
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoRevert "CI: Remove an obsolete workaround"
Simon McVittie [Tue, 6 Jun 2023 10:00:28 +0000 (11:00 +0100)] 
Revert "CI: Remove an obsolete workaround"

It appears some freedesktop CI runners still have /builds/dbus/dbus
owned by a different user ID.
This reverts commit 3f6400b8b929d902b7317e90440bd369c8f5407a.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoREADME: Mention not opening merge requests for security issues
Simon McVittie [Tue, 6 Jun 2023 09:41:35 +0000 (10:41 +0100)] 
README: Mention not opening merge requests for security issues

The dbus maintainers can open confidential merge requests by using a
private git repository, but other contributors (including most security
researchers) cannot, so the safest simple recommendation is no merge
requests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoREADME: Adjust wording
Simon McVittie [Tue, 6 Jun 2023 09:39:40 +0000 (10:39 +0100)] 
README: Adjust wording

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoUpdate NEWS
Simon McVittie [Mon, 5 Jun 2023 18:49:31 +0000 (19:49 +0100)] 
Update NEWS

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'readme-meson-steps' into 'master'
Simon McVittie [Fri, 2 Jun 2023 15:09:12 +0000 (15:09 +0000)] 
Merge branch 'readme-meson-steps' into 'master'

README: add meson build steps

See merge request dbus/dbus!402

2 years agoREADME: add meson build steps
Ahmed Abdelfattah [Sun, 16 Apr 2023 11:21:35 +0000 (13:21 +0200)] 
README: add meson build steps

* Add meson build instructions and reorder the README sections
* Fix a small typo for the security section

Signed-off-by: Ahmed Abdelfattah <a.abfattah@gmail.com>
2 years agoMerge branch 'wip/smcv/reinstate-windows-ci' into 'master'
Simon McVittie [Tue, 16 May 2023 11:01:27 +0000 (11:01 +0000)] 
Merge branch 'wip/smcv/reinstate-windows-ci' into 'master'

Revert "CI: Disable native Windows builds for now"

Closes #456

See merge request dbus/dbus!406

2 years agoRevert "CI: Disable native Windows builds for now"
Simon McVittie [Tue, 16 May 2023 10:46:22 +0000 (11:46 +0100)] 
Revert "CI: Disable native Windows builds for now"

It seems they do work, it was just very slow to build the image.

This reverts commit a3a14ea09eb3ade08cd6b4c6af57afd8b1c0b8bb.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/456
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'read_procfs' into 'master'
Simon McVittie [Mon, 15 May 2023 20:16:02 +0000 (20:16 +0000)] 
Merge branch 'read_procfs' into 'master'

Support /proc in _dbus_file_get_content

See merge request dbus/dbus!401

2 years agoSupport /proc in _dbus_file_get_content
Luca Boccassi [Mon, 20 Mar 2023 01:40:20 +0000 (01:40 +0000)] 
Support /proc in _dbus_file_get_content

procfs has special semantics: most files are 0 size,
only one read can be done on a file, and they are
not larger than 4MB. Enhance _dbus_file_get_content()
so that we can read files from /proc with it.

Signed-off-by: Luca Boccassi <bluca@debian.org>
2 years agoMerge branch 'use_func_macro' into 'master'
Simon McVittie [Mon, 15 May 2023 19:01:40 +0000 (19:01 +0000)] 
Merge branch 'use_func_macro' into 'master'

do not use __FUNCTION__ directly

See merge request dbus/dbus!404

2 years agodbus-spawn-win: use `_DBUS_FUNCTION_NAME` instead of `__FUNCTION__`
Barnabás Pőcze [Thu, 4 May 2023 14:37:57 +0000 (16:37 +0200)] 
dbus-spawn-win: use `_DBUS_FUNCTION_NAME` instead of `__FUNCTION__`

dbus-internals.h already defines a macro which expands to the name
of the current function based on C standard version, etc. So use
that instead of hard-coding `__FUNCTION__`.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
2 years agodbus-sysdeps-win: do not log function name twice
Barnabás Pőcze [Thu, 4 May 2023 14:31:44 +0000 (16:31 +0200)] 
dbus-sysdeps-win: do not log function name twice

`_dbus_verbose()` already logs the function name,
do not log it again in the message.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
2 years agodbus-internals: use `_DBUS_FUNCTION_NAME` in `_dbus_verbose()`
Barnabás Pőcze [Thu, 4 May 2023 14:26:31 +0000 (16:26 +0200)] 
dbus-internals: use `_DBUS_FUNCTION_NAME` in `_dbus_verbose()`

dbus-internals.h already defines a macro which expands to the name
of the current function based on C standard version, etc. So use
that instead of hard-coding `__FUNCTION__`.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
2 years agoMerge branch 'dbus_msg_iter_fix_memleak' into 'master'
Simon McVittie [Mon, 15 May 2023 18:55:43 +0000 (18:55 +0000)] 
Merge branch 'dbus_msg_iter_fix_memleak' into 'master'

dbus_message_iter_get_signature: Fix two memory leaks

See merge request dbus/dbus!403

2 years agodbus_message_iter_get_signature: Fix two memory leaks on OOM
Barnabás Pőcze [Sat, 22 Apr 2023 19:37:59 +0000 (21:37 +0200)] 
dbus_message_iter_get_signature: Fix two memory leaks on OOM

Previously,  `retstr` would not be freed when `_dbus_string_append_len()`
or `_dbus_string_steal_data()` failed.

Fix those by:
 * jumping to `_dbus_string_free()` when `_dbus_string_append_len()` fails
 * ignoring the return value of `_dbus_string_free()`.

The latter works because in case of failure, `ret` will be set
to NULL by `_dbus_string_steal_data()`.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
2 years agoMerge branch 'wip/smcv/fix-ci' into 'master'
Simon McVittie [Fri, 12 May 2023 18:06:36 +0000 (18:06 +0000)] 
Merge branch 'wip/smcv/fix-ci' into 'master'

Fix CI

See merge request dbus/dbus!405

2 years agoCI: Disable native Windows builds for now
Simon McVittie [Fri, 12 May 2023 17:35:13 +0000 (18:35 +0100)] 
CI: Disable native Windows builds for now

These are extremely slow (the image build is currently at 36 minutes
and still running) which is standing in the way of us having functional
CI at all. They can be re-enabled if someone will maintain them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Disable "opensuse mingw64 cmake debug" until #455 is fixed
Simon McVittie [Fri, 12 May 2023 17:32:35 +0000 (18:32 +0100)] 
CI: Disable "opensuse mingw64 cmake debug" until #455 is fixed

Having some CI is better than having no CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Avoid using a no-op download location that gives a 403 error
Simon McVittie [Fri, 12 May 2023 16:48:48 +0000 (17:48 +0100)] 
CI: Avoid using a no-op download location that gives a 403 error

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Make creation of user idempotent
Simon McVittie [Fri, 12 May 2023 15:19:38 +0000 (16:19 +0100)] 
CI: Make creation of user idempotent

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Disable OOM-testing code paths for Meson, matching Autotools and CMake
Simon McVittie [Fri, 12 May 2023 14:31:58 +0000 (15:31 +0100)] 
CI: Disable OOM-testing code paths for Meson, matching Autotools and CMake

Repeatedly re-running each test with different malloc() calls failing
is really slow, and in particular this is making
dbus:dbus / marshal-recursive time out on freedesktop.org CI.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Install mingw64-cross-cmake in openSUSE image
Simon McVittie [Fri, 12 May 2023 14:28:47 +0000 (15:28 +0100)] 
CI: Install mingw64-cross-cmake in openSUSE image

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Sort lists of openSUSE packages alphabetically
Simon McVittie [Fri, 12 May 2023 14:28:11 +0000 (15:28 +0100)] 
CI: Sort lists of openSUSE packages alphabetically

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Update Windows runners
Simon McVittie [Fri, 12 May 2023 14:24:17 +0000 (15:24 +0100)] 
CI: Update Windows runners

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Remove an obsolete workaround
Simon McVittie [Fri, 12 May 2023 14:01:32 +0000 (15:01 +0100)] 
CI: Remove an obsolete workaround

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Update to current fdo CI templates
Simon McVittie [Fri, 12 May 2023 14:01:15 +0000 (15:01 +0100)] 
CI: Update to current fdo CI templates

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Only run for pushes to dbus
Simon McVittie [Fri, 12 May 2023 14:23:27 +0000 (15:23 +0100)] 
CI: Only run for pushes to dbus

In practice the pipeline is going to fail for namespaces other than
dbus, so don't waste time on trying to run it there; only run the
detached pipeline for the MR.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Run a detached pipeline for merge requests
Simon McVittie [Fri, 12 May 2023 14:00:34 +0000 (15:00 +0100)] 
CI: Run a detached pipeline for merge requests

After abuses of fdo infrastructure were mitigated in
freedesktop/freedesktop#540, contributors cannot usually run pipelines
in their own forks of dbus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'cmake_unistd' into 'master'
Simon McVittie [Tue, 21 Mar 2023 20:21:22 +0000 (20:21 +0000)] 
Merge branch 'cmake_unistd' into 'master'

cmake: add missing HAVE_SYS_SYSCALL_H define

See merge request dbus/dbus!400

2 years agocmake: add missing HAVE_SYS_SYSCALL_H define
Luca Boccassi [Mon, 20 Mar 2023 13:37:08 +0000 (13:37 +0000)] 
cmake: add missing HAVE_SYS_SYSCALL_H define

Signed-off-by: Luca Boccassi <bluca@debian.org>
2 years agoMerge branch 'fix-dbus-api-design-wrong-closing-tag' into 'master'
Simon McVittie [Thu, 2 Mar 2023 14:33:07 +0000 (14:33 +0000)] 
Merge branch 'fix-dbus-api-design-wrong-closing-tag' into 'master'

doc/dbus-api-design: fix wrong closing tag

See merge request dbus/dbus!396

2 years agodoc/dbus-api-design: fix wrong closing tag
Yen-Chin, Lee [Thu, 2 Mar 2023 07:31:28 +0000 (15:31 +0800)] 
doc/dbus-api-design: fix wrong closing tag

The original code of 'ProgressNotification' had a wrong closing tag,
which should use '</signal>' instead of '</method>'

Signed-off-by: Yen-Chin, Lee <coldnew.tw@gmail.com>
2 years agoMerge branch 'fix-issue-445' into 'master'
Simon McVittie [Tue, 21 Feb 2023 20:40:19 +0000 (20:40 +0000)] 
Merge branch 'fix-issue-445' into 'master'

CI: Make sure we always have a messagebus user, even if the dbus package isn't installed

Closes #445

See merge request dbus/dbus!394

2 years agotools/ci-install.sh: Make sure we always have a messagebus user, even if the dbus...
Ralf Habacker [Tue, 21 Feb 2023 09:37:36 +0000 (10:37 +0100)] 
tools/ci-install.sh: Make sure we always have a messagebus user, even if the dbus package isn't installed

This fixes a CI installation issue with the meson build system on openSUSE
distribution.

Fixes #445

2 years agoStart 1.15.6
Simon McVittie [Wed, 8 Feb 2023 16:53:37 +0000 (16:53 +0000)] 
Start 1.15.6

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoUpdate AUTHORS
Simon McVittie [Wed, 8 Feb 2023 16:51:33 +0000 (16:51 +0000)] 
Update AUTHORS

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoPrepare v1.15.4 dbus-1.15.4
Simon McVittie [Wed, 8 Feb 2023 11:55:54 +0000 (11:55 +0000)] 
Prepare v1.15.4

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoNEWS: Add #421
Simon McVittie [Wed, 8 Feb 2023 10:47:08 +0000 (10:47 +0000)] 
NEWS: Add #421

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years ago_dbus_string_skip_blank(): Let the final assert follow the previous search
Ralf Habacker [Thu, 19 Jan 2023 15:17:43 +0000 (16:17 +0100)] 
_dbus_string_skip_blank(): Let the final assert follow the previous search

This appears to have been a copy/paste mistake. If only blanks (defined as
spaces or tabs) were removed, then it cannot be right to check for white
space (defined as spaces, tabs, carriage return or linefeed) afterwards.

If libdbus was compiled with assertions enabled, then this is a
denial-of-service issue for dbus-daemon or other users of DBusServer:
an unauthenticated user with access to the server's socket can send
whitespace that triggers this assertion failure. We recommend that
production versions of dbus, for example in OS distributions, should be
compiled with checks but without assertions.

[smcv: expanded commit message]

Thanks: Evgeny Vereshchagin
Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/421

2 years agoAdd test for _dbus_string_skip_blank()
Ralf Habacker [Thu, 19 Jan 2023 15:18:56 +0000 (16:18 +0100)] 
Add test for _dbus_string_skip_blank()

[smcv: Fix a memory leak]

Reproduces: https://gitlab.freedesktop.org/dbus/dbus/-/issues/421

2 years agoUpdate NEWS for 1.15.x
Simon McVittie [Wed, 8 Feb 2023 10:32:54 +0000 (10:32 +0000)] 
Update NEWS for 1.15.x

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'add-ci-build-libdbus-subproject' into 'master'
Simon McVittie [Tue, 7 Feb 2023 10:05:16 +0000 (10:05 +0000)] 
Merge branch 'add-ci-build-libdbus-subproject' into 'master'

gitlab-ci: build libdbus as subproject

See merge request dbus/dbus!388

2 years agogitlab-ci: build libdbus as subproject
Daniel Wagner [Fri, 13 Jan 2023 12:29:06 +0000 (13:29 +0100)] 
gitlab-ci: build libdbus as subproject

Test it's possible to consume libdbus as a subproject.

Suggested-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agobuild: Use list for dbus_static_flags
Daniel Wagner [Fri, 13 Jan 2023 13:04:19 +0000 (14:04 +0100)] 
build: Use list for dbus_static_flags

Meson complains that it is only allowed to concatenate list to lists and
not strings.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
Origin: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/388

2 years agoMerge branch 'add-test-header-fields' into 'master'
Simon McVittie [Mon, 6 Feb 2023 13:58:57 +0000 (13:58 +0000)] 
Merge branch 'add-test-header-fields' into 'master'

cmake: add missing test for header-fields

See merge request dbus/dbus!322

2 years ago.gitlab-ci.yml: exclude non-functioning test 'header-fields' in job 'windows vs15...
Ralf Habacker [Fri, 7 Oct 2022 09:53:23 +0000 (11:53 +0200)] 
.gitlab-ci.yml: exclude non-functioning test 'header-fields' in job 'windows vs15-64 cmake'

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2 years agocmake: add missing test for header-fields
Ralf Habacker [Mon, 27 Jun 2022 21:18:09 +0000 (23:18 +0200)] 
cmake: add missing test for header-fields

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2 years agoMerge branch 'gitlab-ci' into 'master'
Simon McVittie [Mon, 6 Feb 2023 13:36:43 +0000 (13:36 +0000)] 
Merge branch 'gitlab-ci' into 'master'

CI: Avoid changing uid, except when running installed-tests

Closes #447

See merge request dbus/dbus!392

2 years agoCI: Re-run some tests as root or as non-root, as appropriate
Simon McVittie [Mon, 6 Feb 2023 13:24:11 +0000 (13:24 +0000)] 
CI: Re-run some tests as root or as non-root, as appropriate

On Gitlab-CI we're always running the overall script as root (and
therefore we'll only enter the code path to re-run as non-root),
but when using these scripts for manual testing they might be run as
non-root to begin with.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Remove vestigial support for re-running tests in a Docker container
Simon McVittie [Mon, 6 Feb 2023 13:23:05 +0000 (13:23 +0000)] 
CI: Remove vestigial support for re-running tests in a Docker container

Travis CI needed this, but Gitlab-CI always runs our tests in a Docker
container of our choice, so there's never any need to enter another
(and it's not allowed anyway).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Re-clone the git repository every time
Simon McVittie [Mon, 6 Feb 2023 13:14:23 +0000 (13:14 +0000)] 
CI: Re-clone the git repository every time

This cleans up checkouts that were subjected to `chown -R` prior to this.

Resolves: dbus/dbus#447
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoCI: Don't change ownership of source directory
Simon McVittie [Mon, 6 Feb 2023 13:13:04 +0000 (13:13 +0000)] 
CI: Don't change ownership of source directory

These CI scripts were originally used on Travis-CI, which starts all
builds as an ordinary user that has the ability to become root via `sudo`.
On Gitlab-CI, we don't need that: we start as uid 0, and can do the
whole CI run like that. This also means we get somewhat better test
coverage, because some of our unit tests benefit from being run as uid 0.

The only test coverage we lose by being uid 0 is that
test_pending_fd_timeout() in test/dbus-daemon.c is skipped, because
uid 0 bypasses the limit that's under test there.

2 years agoMerge branch 'alignof' into 'master'
Simon McVittie [Mon, 16 Jan 2023 12:23:20 +0000 (12:23 +0000)] 
Merge branch 'alignof' into 'master'

Define _DBUS_ALIGNOF using _Alignof when using C11 or newer

See merge request dbus/dbus!389

2 years agoDefine _DBUS_ALIGNOF using _Alignof when using C11 or newer
Khem Raj [Sat, 14 Jan 2023 20:39:43 +0000 (12:39 -0800)] 
Define _DBUS_ALIGNOF using _Alignof when using C11 or newer

WG14 N2350 made very clear that it is an UB having type definitions
within "offsetof" [1]. This patch changes the implementation of macro
_DBUS_ALIGNOF to builtin "_Alignof" to avoid undefined behavior.

clang 16+ has started to diagnose this [2]

Fixes build when using -std >= gnu11 and using clang16+

[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
[2] https://reviews.llvm.org/D133574

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 years agoMerge branch 'jepio/fix-log-callback-segfault' into 'master'
Simon McVittie [Tue, 10 Jan 2023 11:59:06 +0000 (11:59 +0000)] 
Merge branch 'jepio/fix-log-callback-segfault' into 'master'

bus/selinux: Move vsnprintf call to avoid va_list reuse

See merge request dbus/dbus!386

2 years agobus/selinux: Move vsnprintf call to avoid va_list reuse
Jeremi Piotrowski [Mon, 9 Jan 2023 16:11:32 +0000 (17:11 +0100)] 
bus/selinux: Move vsnprintf call to avoid va_list reuse

In log_callback() the same va_list is reused for a call to vsnprintf and
vsyslog. A va_list can't be reused in this manner, such use is undefined
behavior that changes depending on glibc version.

In current glibc versions a segfault can be observed from the callsite at
bus/selinux.c:412. When trying to log a non-auditable event, the segfault
happens in strlen inside vsyslog.

Moving the call to vsnprintf closer to audit_log_user_avc_message (which is
followed by a 'goto out') avoids the reuse and segfault.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2 years agoMerge branch 'meson-fvisibility-hidden' into 'master'
Simon McVittie [Mon, 9 Jan 2023 15:01:52 +0000 (15:01 +0000)] 
Merge branch 'meson-fvisibility-hidden' into 'master'

meson: Use -fvisibility=hidden on Unix if supported

See merge request dbus/dbus!383

2 years agomeson: Use -fvisibility=hidden on Unix if supported
Simon McVittie [Fri, 6 Jan 2023 13:49:17 +0000 (13:49 +0000)] 
meson: Use -fvisibility=hidden on Unix if supported

This avoids accidentally exporting all of our private symbols as part
of the LIBDBUS_PRIVATE_x.y.z verdef, including ones that don't need to
be visible outside the shared library even when testing internals
(_dbus_watch_set_handler is a good example).

Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/437
Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoMerge branch 'fix-data-race' into 'master'
Ralf Habacker [Sat, 7 Jan 2023 09:17:43 +0000 (09:17 +0000)] 
Merge branch 'fix-data-race' into 'master'

Fix data race with members of struct DBusCounter

Closes #426

See merge request dbus/dbus!379

2 years agoFix data race in multithreaded application
Ralf Habacker [Tue, 3 Jan 2023 13:29:14 +0000 (14:29 +0100)] 
Fix data race in multithreaded application

This commit fixes a data race condition discovered by the
gcc thread sanitizer by also locking the associated mutex
when reading the corresponding counter.

Fixes #426

2 years agoAdd multithreaded unit test for DBusCounter to available build systems
Ralf Habacker [Tue, 3 Jan 2023 13:21:51 +0000 (14:21 +0100)] 
Add multithreaded unit test for DBusCounter to available build systems

The mentioned test is build on unix like platforms when embedded tests
are enabled.

2 years agoMerge branch 'meson-declare-dependency' into 'master'
Simon McVittie [Wed, 4 Jan 2023 14:26:56 +0000 (14:26 +0000)] 
Merge branch 'meson-declare-dependency' into 'master'

meson: Declare dependency for use as a subproject

See merge request dbus/dbus!368

2 years agomeson: Introduce message_bus and tools command line option
Daniel Wagner [Thu, 24 Nov 2022 08:17:45 +0000 (09:17 +0100)] 
meson: Introduce message_bus and tools command line option

To make the consume libdbus via Meson's subproject use case more useful,
introduce message_bus and tools command line options which control if
the D-Bus daemon and/or the tools are build. The idea here is that
depending projects are interested only in the library.

The strong recommendation is only to build libdbus as static library:

  libdbus_dep = dependency(
    'dbus-1',
    required: get_option('libdbus'),
    fallback: ['dbus', 'libdbus_dep'],
    default_options: [
      'default_library=static',
      'embedded_tests=false',
      'message_bus=false',
      'modular_tests=disabled',
      'tools=false',
    ],
  )

This ensures that any installed D-Bus infrastructure on the target
system is not overwritten.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agomeson: Declare dependency
Daniel Wagner [Tue, 22 Nov 2022 14:43:47 +0000 (15:43 +0100)] 
meson: Declare dependency

Allow other Meson project to consume libdbus as subproject. For this
we need to instantiate a dependency object.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
2 years agoMerge branch 'spdx-afl-2.1-or-gpl-2.0' into 'master'
Ralf Habacker [Wed, 4 Jan 2023 07:54:16 +0000 (07:54 +0000)] 
Merge branch 'spdx-afl-2.1-or-gpl-2.0' into 'master'

Add SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license

See merge request dbus/dbus!375

2 years agodbus/dbus-macros-internal.h: Add blank line after the copyright state
Ralf Habacker [Wed, 4 Jan 2023 07:32:55 +0000 (08:32 +0100)] 
dbus/dbus-macros-internal.h: Add blank line after the copyright state

Thus it is identical with the other places.

2 years agoAdd SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license
Ralf Habacker [Mon, 2 Jan 2023 14:31:43 +0000 (15:31 +0100)] 
Add SPDX license marker for the AFL-2.1 OR GPL-2.0-or-later license

The full license texts are not added because they were already
added in a previous commit.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
see #394

2 years agoMerge branch 'master' into 'master'
Ralf Habacker [Wed, 4 Jan 2023 07:40:59 +0000 (07:40 +0000)] 
Merge branch 'master' into 'master'

_dbus_loop_iterate: `timeout` can be defined as int

See merge request dbus/dbus!381

2 years ago_dbus_loop_iterate: `timeout` can be defined as int
Xin Shi [Wed, 4 Jan 2023 02:19:56 +0000 (10:19 +0800)] 
_dbus_loop_iterate: `timeout` can be defined as int

all places where `timeout` is used can be represented as int.
This MR is a response to issue #430.

Signed-off-by: Xin Shi <shixin21@huawei.com>
2 years agoMerge branch 'spdx-FSFULLR' into 'master'
Simon McVittie [Tue, 3 Jan 2023 19:24:08 +0000 (19:24 +0000)] 
Merge branch 'spdx-FSFULLR' into 'master'

Add SPDX license marker for the FSFULLR license

See merge request dbus/dbus!376

2 years agoAdd SPDX license marker for the FSFULLR license
Ralf Habacker [Mon, 2 Jan 2023 14:55:31 +0000 (15:55 +0100)] 
Add SPDX license marker for the FSFULLR license

The associated full license text was retrieved from https://spdx.org.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2 years agoMerge branch 'fix-425' into 'master'
Simon McVittie [Tue, 3 Jan 2023 19:02:12 +0000 (19:02 +0000)] 
Merge branch 'fix-425' into 'master'

Permit access to /tmp dbus socket

See merge request dbus/dbus!380

2 years agoPermit access to /tmp dbus socket
Dave Jones [Tue, 3 Jan 2023 18:42:51 +0000 (18:42 +0000)] 
Permit access to /tmp dbus socket

After 6e48c317 the test-apparmor-activation test fails as it can no
longer access the dbus socket in /tmp. This commit updates the apparmor
profile used within the test

2 years agoMerge branch 'master' into 'master'
Ralf Habacker [Tue, 3 Jan 2023 10:47:04 +0000 (10:47 +0000)] 
Merge branch 'master' into 'master'

socket_handle_watch: break when `found` is TRUE in server

See merge request dbus/dbus!374