Commit graph

5911 commits

Author SHA1 Message Date
Simon McVittie
fcbb5e6586 test: Move TAP helpers into dbus-testutils if embedded tests are disabled
This lets us run a subset of the tests that previously relied on extra
test-only code being compiled into libdbus.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-20 10:13:04 +01:00
Simon McVittie
c46e002fe6 _dbus_test_check: Wrap body of macro in do/while
This avoids unexpected precedence when used as the body of an "if" or
"else" without being wrapped in {}.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-20 10:11:38 +01:00
Simon McVittie
0ddc510130 Merge branch 'ci-updates' into 'master'
CI: Update to Debian 10 'buster', drop Debian 8 'jessie', add qhelpgenerator

See merge request dbus/dbus!151
2020-04-16 10:25:39 +00:00
Simon McVittie
9c255cbd7e Merge branch 'fix-bar-length' into 'master'
spec: fix typo in example

See merge request dbus/dbus!152
2020-04-16 09:49:37 +00:00
Zygmunt Krynicki
d61d10eb67 spec: fix typo in example
The length of "bar" is encoded as 3. The annotation is incorrect.
2020-04-16 06:55:42 +00:00
Simon McVittie
23e1f044f4 CI: Install qhelpgenerator for native production build on buster
This will be used in dbus!150.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-06 14:59:34 +01:00
Simon McVittie
3ce28815e9 CI: Don't build on Debian 8 'jessie'
Debian 8 'jessie' has reached EOL for mainstream security support,
which puts it outside our usual distribution/OS support policy.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-06 14:50:02 +01:00
Simon McVittie
73cfcb95c6 CI: Build on Debian 10 'buster' by default
Previously, we built on Debian 9 'stretch' by default, and on
Debian 10 'buster' only on request. Let's reverse that so that we get
more modern toolchains, before Debian 9 'stretch' reaches EOL.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-04-06 14:49:19 +01:00
Simon McVittie
1530582863 Merge branch 'fix-poll-header' into 'master'
sysdeps: use POSIX poll.h instead of sys/poll.h

See merge request dbus/dbus!148
2020-04-01 14:17:52 +00:00
Simon McVittie
16ce800e99 Merge branch 'fallback_to_getrandom' into 'master'
_dbus_generate_random_bytes: fallback to getrandom(2)

See merge request dbus/dbus!147
2020-04-01 14:16:39 +00:00
Natanael Copa
3509748dce sysdeps: use POSIX poll.h instead of sys/poll.h
POSIX.1-2001 and POSIX.1-2008 specifies include <poll.h> so use that
rather than the non-standard/legacy include <sys/poll.h>.

This fixes the following warnings when building with musl libc:

    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2020-03-26 18:17:22 +01:00
Natanael Copa
6d92e8e983 _dbus_generate_random_bytes: use getrandom(2)
Use getrandom(2) and fall back to /dev/urandom if it is missing or if it
fails some any reason.

This solves problem where dbus-uuidgen is called from a chroot which
lacks /dev/urandom.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2020-03-26 16:56:59 +01:00
Simon McVittie
09a50e76d2 Merge branch 'fix_indentation' into 'master'
Fix indentation in bus source file

See merge request dbus/dbus!149
2020-03-25 14:19:40 +00:00
Taras Zaporozhets
73139d57bb Fix indentation in bus source file 2020-03-25 13:22:38 +01:00
Ralf Habacker
07ba6c0a40 Merge branch 'mr143-refactoring' into 'master'
sysdeps-win: Refactor cleanup of struct addrinfo during connect()

See merge request dbus/dbus!145
2020-03-11 16:13:47 +00:00
Simon McVittie
3197cbe369 Merge branch 'non-posix-getwpnam-r' into 'master'
Remove support for non-POSIX getpwnam_r()

See merge request dbus/dbus!11
2020-03-11 14:15:29 +00:00
Simon McVittie
e70f19d48f Merge branch 'mr143-but-unix' into 'master'
sysdeps-unix: Don't leak struct addrinfo on OOM during connect()

See merge request dbus/dbus!144
2020-03-11 14:11:09 +00:00
Simon McVittie
ab705c14cb sysdeps-win: Refactor cleanup of struct addrinfo during connect()
As suggested on !143. Instead of remembering to free it in every error
condition, let's move its cleanup to the "out" phase so that it's done
every time.

Change the iterator variable tmp to be const so that it's obvious we
aren't meant to free that too.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-11 13:17:43 +00:00
Simon McVittie
682e619196 sysdeps-unix: Don't leak struct addrinfo on OOM during connect()
If we ran out of memory while handling connect() errors, we didn't
free the linked list of struct addrinfo. Move their cleanup to the
"out" phase of the function so that we always do it.

While I'm there, change the iterator variable tmp to be const, to make
it more obvious that we aren't meant to free it.

This is similar to commit 00badeba (!143) in the corresponding Windows
code path, but with some refactoring.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-03-11 13:12:55 +00:00
Simon McVittie
041cadb738 Merge branch 'coverity-354880' into 'master'
Fix missing release of the memory allocated in _dbus_connect_tcp_socket_with_nonce() in OOM case

See merge request dbus/dbus!143
2020-03-11 13:03:34 +00:00
Ralf Habacker
00badebaac Fix missing release of the memory allocated in _dbus_connect_tcp_socket_with_nonce() in OOM case
If there is no more memory available within the mentiond function, e.g.,
when checking memory management, the release of memory allocated by
getaddrinfo() is missing.

Coverity CID: 354880
2020-03-10 23:03:03 +01:00
Simon McVittie
bf0eaec4d9 Merge branch 'monitor-list' into 'master'
bus: Don't explicitly clear BusConnections.monitors

Closes #291

See merge request dbus/dbus!140
2020-02-25 12:49:44 +00:00
Simon McVittie
0f04661531 Merge branch 'fix-cmake-doc-build' into 'master'
Fix cmake doc build

See merge request dbus/dbus!137
2020-02-21 00:59:46 +00:00
Ralf Habacker
a094728abd cmake: Don't build dbus.devhelp2 if Doxygen is disabled
Previously this would be attempted whenever xsltproc was found, but
would fail if Doxygen documentation was disabled.
2020-02-20 20:02:30 +01:00
Simon McVittie
72911888b6 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2020-02-20 13:14:06 +00:00
Simon McVittie
b034b83b59 bus: Don't explicitly clear BusConnections.monitors
Each connection that is an active monitor holds a pointer to its own
link in this list, via BusConnectionData.link_in_monitors. We can't
validly free the list while these pointers exist: that would be a
use-after-free, when each connection gets disconnected and tries to
remove itself from the list.

Instead, let each connection remove itself from the list, then assert
that the list has become empty.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/291
2020-02-20 12:43:34 +00:00
Simon McVittie
b6fd40cef9 Merge branch 'let-dbus_verbose_real-use-dbus-string' into 'master'
In _dbus_verbose_real() use DBusString instance to avoid possible stack smashing

Closes #45

See merge request dbus/dbus!133
2020-02-20 08:50:01 +00:00
Ralf Habacker
c0aea35e13 In _dbus_verbose_real() avoid possible stack overflows on output to the Windows debug port
Instead of creating a fixed memory area on the stack that can lead to
a stack overflow if exceeded, this configuration now uses a DBusString
instance that dynamically manages memory.

Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/45
2020-02-20 08:50:00 +00:00
Simon McVittie
773f136787 Merge branch 'utf8-compliant-versioninfo' into 'master'
Transcoding template file for version information under Windows to utf-8

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

See merge request dbus/dbus!138
2020-02-20 01:02:48 +00:00
Ralf Habacker
8ffe1b949c cmake: Fix attribute 'original file name' in shared dbus library file info on Windows
The 'original filename' attribute was 'libdbus-1-3}.dll' with an unwanted
curly bracket.
2020-02-19 23:41:08 +01:00
Simon McVittie
a60f4a2ca0 Merge branch 'complete-version-info-on-windows' into 'master'
cmake: complete adding version info to all installed executables on Windows

See merge request dbus/dbus!136
2020-02-19 20:58:16 +00:00
Ralf Habacker
2d256d42ce cmake: complete adding version info to all installed executables on Windows 2020-02-19 10:23:01 +01:00
Simon McVittie
bfad7898cc Merge branch 'master' into 'master'
cmake: add X11 include directories to tools

See merge request dbus/dbus!129
2020-01-23 11:36:21 +00:00
Tuomo Rinne
5314ced357 cmake: Add X11 include path for tools
Fixes compilation issues for case when X11 is not in a standard location
2020-01-22 21:56:53 +00:00
Ralf Habacker
5f75ed43c5 Merge branch 'fix-static-vars-thread-safety-issues' into 'master'
Fix static vars thread safety issues

Related to dbus/dbus#88

See merge request dbus/dbus!132
2019-12-13 15:20:59 +00:00
Ralf Habacker
e4feb9600e Add a trivial sanity-check for the atomic primitives
This doesn't verify that they're atomic, but does verify that they
return the right things.

This commit adds a new test function _dbus_test_check (a) to make
writing tests easier. It checks the given boolean expression and
generates a "not ok" test result if the expression is false.

Due to the current design of the test api, the test is only compiled
if embedded tests were enabled at the time of configuration.

It was also necessary to move the test_atomic target definitions in
test/Makefile.am to the --enable-embedded-tests section to avoid a
make distcheck build error.

The test case itself has been authored by smcv.

Co-authored-by: Simon McVittie <smcv@collabora.com>
2019-12-13 16:13:53 +01:00
Simon McVittie
bf20f73873 _dbus_modify_sigpipe: be thread-safe
This needs new atomic primitives: we don't have "set to a value",
and in fact that's a bit annoying to implement in terms of gcc
intrinsics. "Set to 0" and "set to nonzero" are easy, though.
2019-12-12 09:36:32 +01:00
Simon McVittie
4e3d6bffe2 various: comment static variables that are locked or otherwise OK 2019-12-12 09:36:24 +01:00
Simon McVittie
5c0575850f Merge branch 'no-mapping2' into 'master'
Stop using selinux_set_mapping() function

Closes #198

See merge request dbus/dbus!128
2019-10-23 11:03:16 +00:00
Laurent Bigonville
6072f8b241 Stop using selinux_set_mapping() function
Currently, if the "dbus" security class or the associated AV doesn't
exist, dbus-daemon fails to initialize and exits immediately. Also the
security classes or access vector cannot be reordered in the policy.
This can be a problem for people developing their own policy or trying
to access a machine where, for some reasons, there is not policy defined
at all.

The code here copy the behaviour of the selinux_check_access() function.
We cannot use this function here as it doesn't allow us to define the
AVC entry reference.

See the discussion at https://marc.info/?l=selinux&m=152163374332372&w=2

Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/198
2019-10-22 19:12:13 +02:00
Ralf Habacker
baffedbac9 Merge branch 'fix_1' into 'master'
doxygen: fix example for dbus_message_append_args

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

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

Closes #275

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

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

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