Commit graph

6738 commits

Author SHA1 Message Date
Barnabás Pőcze
b5a87e214f 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>
2023-05-12 18:16:47 +00:00
Simon McVittie
a841b8ec8f Merge branch 'wip/smcv/fix-ci' into 'master'
Fix CI

See merge request dbus/dbus!405
2023-05-12 18:06:36 +00:00
Simon McVittie
a3a14ea09e 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>
2023-05-12 18:35:13 +01:00
Simon McVittie
21f2f4f757 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>
2023-05-12 18:32:35 +01:00
Simon McVittie
a56de4684b CI: Avoid using a no-op download location that gives a 403 error
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 17:48:48 +01:00
Simon McVittie
b1712683ad CI: Make creation of user idempotent
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 17:47:25 +01:00
Simon McVittie
a6da40b206 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>
2023-05-12 15:40:45 +01:00
Simon McVittie
66a4119fb9 CI: Install mingw64-cross-cmake in openSUSE image
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
e271f286e3 CI: Sort lists of openSUSE packages alphabetically
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
7a6e9f5beb CI: Update Windows runners
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
3f6400b8b9 CI: Remove an obsolete workaround
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
3629e8a2e4 CI: Update to current fdo CI templates
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-05-12 15:40:45 +01:00
Simon McVittie
4a514593d6 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>
2023-05-12 15:40:45 +01:00
Simon McVittie
dbbd4a32f1 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>
2023-05-12 15:00:34 +01:00
Simon McVittie
35ade3c8f7 Merge branch 'cmake_unistd' into 'master'
cmake: add missing HAVE_SYS_SYSCALL_H define

See merge request dbus/dbus!400
2023-03-21 20:21:22 +00:00
Luca Boccassi
62c870aa5e cmake: add missing HAVE_SYS_SYSCALL_H define
Signed-off-by: Luca Boccassi <bluca@debian.org>
2023-03-20 22:10:41 +00:00
Simon McVittie
37cd0d7619 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
2023-03-02 14:33:07 +00:00
Yen-Chin, Lee
e80f4cbf78 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>
2023-03-02 15:31:28 +08:00
Simon McVittie
ad401d5e14 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
2023-02-21 20:40:19 +00:00
Ralf Habacker
344a47a41f 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
2023-02-21 10:43:28 +01:00
Simon McVittie
4e8bf2d05a Start 1.15.6
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 16:53:37 +00:00
Simon McVittie
d84b1cf1ed Update AUTHORS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 16:51:33 +00:00
Simon McVittie
6156578eaa Prepare v1.15.4
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 12:03:30 +00:00
Simon McVittie
50852eb085 NEWS: Add #421
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 12:03:30 +00:00
Ralf Habacker
8d54aa2ffd _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
2023-02-08 12:03:30 +00:00
Ralf Habacker
8189a74c6c Add test for _dbus_string_skip_blank()
[smcv: Fix a memory leak]

Reproduces: https://gitlab.freedesktop.org/dbus/dbus/-/issues/421
2023-02-08 12:03:19 +00:00
Simon McVittie
7a30ab94e6 Update NEWS for 1.15.x
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 10:32:54 +00:00
Simon McVittie
3b872b44eb Merge branch 'add-ci-build-libdbus-subproject' into 'master'
gitlab-ci: build libdbus as subproject

See merge request dbus/dbus!388
2023-02-07 10:05:16 +00:00
Daniel Wagner
b1e8793e8d 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>
2023-02-07 09:07:32 +01:00
Daniel Wagner
cd1a9bb09a 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
2023-02-06 14:02:55 +00:00
Simon McVittie
90a9482cca Merge branch 'add-test-header-fields' into 'master'
cmake: add missing test for header-fields

See merge request dbus/dbus!322
2023-02-06 13:58:57 +00:00
Ralf Habacker
15b6b53ff9 .gitlab-ci.yml: exclude non-functioning test 'header-fields' in job 'windows vs15-64 cmake'
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2023-02-06 13:43:59 +00:00
Ralf Habacker
57ab4c7a48 cmake: add missing test for header-fields
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2023-02-06 13:43:59 +00:00
Simon McVittie
7501a04401 Merge branch 'gitlab-ci' into 'master'
CI: Avoid changing uid, except when running installed-tests

Closes #447

See merge request dbus/dbus!392
2023-02-06 13:36:43 +00:00
Simon McVittie
25e1512c17 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>
2023-02-06 13:24:11 +00:00
Simon McVittie
dfa7eede44 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>
2023-02-06 13:23:05 +00:00
Simon McVittie
ce6af6721f 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>
2023-02-06 13:14:23 +00:00
Simon McVittie
88dd9d5cc7 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.
2023-02-06 13:13:04 +00:00
Simon McVittie
cca6c04637 Merge branch 'alignof' into 'master'
Define _DBUS_ALIGNOF using _Alignof when using C11 or newer

See merge request dbus/dbus!389
2023-01-16 12:23:20 +00:00
Khem Raj
c3e2c873ff 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>
2023-01-14 12:43:15 -08:00
Simon McVittie
218b35a57c 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
2023-01-10 11:59:06 +00:00
Jeremi Piotrowski
52b73d511b 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>
2023-01-09 20:03:29 +00:00
Simon McVittie
237063358e Merge branch 'meson-fvisibility-hidden' into 'master'
meson: Use -fvisibility=hidden on Unix if supported

See merge request dbus/dbus!383
2023-01-09 15:01:52 +00:00
Simon McVittie
c1661d7c5d 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>
2023-01-09 14:46:02 +00:00
Ralf Habacker
81dc8af6ae Merge branch 'fix-data-race' into 'master'
Fix data race with members of struct DBusCounter

Closes #426

See merge request dbus/dbus!379
2023-01-07 09:17:43 +00:00
Ralf Habacker
1741df3b97 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
2023-01-05 16:44:25 +01:00
Ralf Habacker
20febb522b Add multithreaded unit test for DBusCounter to available build systems
The mentioned test is build on unix like platforms when embedded tests
are enabled.
2023-01-05 16:43:55 +01:00
Simon McVittie
255f103b5c Merge branch 'meson-declare-dependency' into 'master'
meson: Declare dependency for use as a subproject

See merge request dbus/dbus!368
2023-01-04 14:26:56 +00:00
Daniel Wagner
afb5bbaba4 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>
2023-01-04 09:35:06 +01:00
Daniel Wagner
6a774fbb79 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>
2023-01-04 09:04:57 +01:00