platform/upstream/dbus.git
8 years agoaudit: use DBUS_SYSTEM_LOG_WARNING if we cannot open the audit fd
Simon McVittie [Thu, 19 Feb 2015 12:08:59 +0000 (12:08 +0000)]
audit: use DBUS_SYSTEM_LOG_WARNING if we cannot open the audit fd

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agobus: move shared libaudit code to a new audit.[ch]
Simon McVittie [Thu, 19 Feb 2015 12:04:26 +0000 (12:04 +0000)]
bus: move shared libaudit code to a new audit.[ch]

This fixes various duplicated libaudit interactions in both
SELinux and AppArmor code paths, including opening two audit sockets
if both SELinux and AppArmor were enabled at compile time.
In particular, audit.c is now the only user of libcap-ng.

This commit is not intended to introduce any functional changes,
except for the de-duplication.

The actual audit_log_user_avc_message() call is still duplicated,
because the SELinux and AppArmor code paths use different mechanisms
to compose the audit message: the SELinux path uses a statically-sized
buffer on the stack which might be subject to truncation, whereas
the AppArmor path uses malloc() (via DBusString) and falls back to
using syslog on a memory allocation failure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89225
Reviewed-by: Colin Walters <walters@verbum.org>
[smcv: minor issues raised during review are subsequently fixed]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years agoUse poll's data types directly, where used at all
Rolland Dudemaine [Thu, 6 Aug 2015 13:01:06 +0000 (14:01 +0100)]
Use poll's data types directly, where used at all

[smcv: added commit message; moved fallback implementation
below definition of DBusPollable; more comments; removed unnecessary cast]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90314
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
8 years ago1.9.19
Simon McVittie [Tue, 21 Jul 2015 20:13:43 +0000 (21:13 +0100)]
1.9.19

8 years agodbus-1.9.16
Simon McVittie [Tue, 21 Jul 2015 16:52:21 +0000 (17:52 +0100)]
dbus-1.9.16

8 years agodbus-1.8.20
Simon McVittie [Tue, 21 Jul 2015 16:32:17 +0000 (17:32 +0100)]
dbus-1.8.20

8 years agoMerge branch 'dbus-1.8'
Simon McVittie [Tue, 21 Jul 2015 16:20:11 +0000 (17:20 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
.gitignore
NEWS
tools/dbus-monitor.c

8 years agoNEWS for 1.8.x
Simon McVittie [Tue, 21 Jul 2015 16:19:25 +0000 (17:19 +0100)]
NEWS for 1.8.x

8 years agodbus-monitor: disable automatic handling of o.fd.Peer messages
Simon McVittie [Fri, 3 Jul 2015 12:50:04 +0000 (13:50 +0100)]
dbus-monitor: disable automatic handling of o.fd.Peer messages

A normal DBusConnection will automatically reply to o.fd.Peer
messages such as Ping. We don't want this: we'll
confuse everyone else by replying to messages that weren't
intended for us.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
(cherry picked from commit d9ee040d0bff2b421bca80c2339dcd9347d906db,
commit message adjusted to describe the impact in versions < 1.9)
Conflicts:
tools/dbus-monitor.c

8 years ago.gitignore: ignore /test-driver, generated by recent Automake
Simon McVittie [Mon, 3 Mar 2014 15:59:10 +0000 (15:59 +0000)]
.gitignore: ignore /test-driver, generated by recent Automake

(cherry picked from commit 1895a8ee5b0e3813b571e9db3528611802ea7f7e)

8 years agoAdd test-case for the same situation as fd.o #90952
Simon McVittie [Fri, 3 Jul 2015 12:59:44 +0000 (13:59 +0100)]
Add test-case for the same situation as fd.o #90952

This does not directly test the code in the previous commit, but it does
confirm that calling dbus_connection_set_route_peer_messages() is enough
to fix the observed bug.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
[smcv: re-worded commit message in response to review]

8 years agodbus-monitor: disable automatic handling of o.fd.Peer messages
Simon McVittie [Fri, 3 Jul 2015 12:50:04 +0000 (13:50 +0100)]
dbus-monitor: disable automatic handling of o.fd.Peer messages

A normal DBusConnection will automatically reply to o.fd.Peer
messages such as Ping. We don't want this: if we are using
traditional eavesdropping with an older dbus-daemon, we'll
confuse everyone else by replying to messages that weren't
intended for us. If we are using the new Monitoring
interface (since 1.9.12), the same still applies, but in
addition, the dbus-daemon will disconnect us for not being
a well-behaved monitor.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90952
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
9 years agobus_registry_new: Assert in case of not valid context parameter to avoid potiental...
Ralf Habacker [Tue, 21 Apr 2015 11:16:53 +0000 (13:16 +0200)]
bus_registry_new: Assert in case of not valid context parameter to avoid potiental crashes (CID 54764).

Because the context parameter is dereferenced several times in related code without a null check,
we need to make sure to have a valid context.

Reported by Coverity: CID 54764: Dereference after null check (FORWARD_NULL)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Wed, 17 Jun 2015 19:41:24 +0000 (20:41 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
NEWS

9 years agoNEWS
Simon McVittie [Wed, 17 Jun 2015 19:40:51 +0000 (20:40 +0100)]
NEWS

9 years agoFix memleak in GetConnectionCredentials handler
Jacek Bukarewicz [Wed, 17 Jun 2015 17:53:41 +0000 (18:53 +0100)]
Fix memleak in GetConnectionCredentials handler

Reply message was not unreferenced when GetConnectionCredentials
handler was successful.

Signed-off-by: Jacek Bukarewicz <j.bukarewicz@samsung.com>
[smcv: changed bus_message_unref() to dbus_message_unref()]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91008

9 years agotests: use the new bus setup for `make installcheck`
Simon McVittie [Wed, 27 May 2015 10:42:44 +0000 (11:42 +0100)]
tests: use the new bus setup for `make installcheck`

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
9 years agodbus-daemon.1: document the new locations
Simon McVittie [Wed, 27 May 2015 10:42:18 +0000 (11:42 +0100)]
dbus-daemon.1: document the new locations

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
9 years agoNEWS
Simon McVittie [Wed, 27 May 2015 10:02:05 +0000 (11:02 +0100)]
NEWS

9 years agoAdjust cmake build to match autoconf installation locations.
Dimitri John Ledkov [Mon, 2 Mar 2015 11:55:54 +0000 (11:55 +0000)]
Adjust cmake build to match autoconf installation locations.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMove session & system bus configuration to datadir, by default.
Dimitri John Ledkov [Wed, 25 Feb 2015 15:39:04 +0000 (15:39 +0000)]
Move session & system bus configuration to datadir, by default.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89280
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoStart towards 1.9.18
Simon McVittie [Wed, 27 May 2015 09:42:46 +0000 (10:42 +0100)]
Start towards 1.9.18

9 years agomore NEWS, also more release name
Simon McVittie [Thu, 14 May 2015 14:04:36 +0000 (15:04 +0100)]
more NEWS, also more release name

9 years ago1.9.16
Simon McVittie [Thu, 14 May 2015 13:50:24 +0000 (14:50 +0100)]
1.9.16

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Thu, 14 May 2015 13:45:04 +0000 (14:45 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
NEWS

9 years agoadd a missing change, fix some bug numbers
Simon McVittie [Thu, 14 May 2015 13:43:53 +0000 (14:43 +0100)]
add a missing change, fix some bug numbers

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Thu, 14 May 2015 13:41:06 +0000 (14:41 +0100)]
Merge branch 'dbus-1.8'

Conflicts:
NEWS
cmake/CMakeLists.txt
configure.ac

9 years agoFail to generate random bytes instead of falling back to rand()
Simon McVittie [Thu, 14 May 2015 11:23:09 +0000 (12:23 +0100)]
Fail to generate random bytes instead of falling back to rand()

This is more robust against broken setups where we run out
of memory or cannot read /dev/urandom.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMake UUID generation failable
Simon McVittie [Tue, 12 May 2015 10:35:04 +0000 (11:35 +0100)]
Make UUID generation failable

Previously, this would always succeed, but might use
weak random numbers in rare failure cases. I don't think
these UUIDs are security-sensitive, but if they're generated
by a PRNG as weak as rand() (<= 32 bits of entropy), we
certainly can't claim that they're universally unique.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years ago_dbus_server_init_base: raise a DBusError
Simon McVittie [Thu, 14 May 2015 11:17:54 +0000 (12:17 +0100)]
_dbus_server_init_base: raise a DBusError

This can currently only fail from OOM, but I'm about to make
it possible to fail from insufficient entropy.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years ago_dbus_server_new_for_socket: raise a DBusError
Simon McVittie [Thu, 14 May 2015 11:17:10 +0000 (12:17 +0100)]
_dbus_server_new_for_socket: raise a DBusError

This can currently only fail due to OOM, but I'm about to
make it possible to fail for other reasons.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: correct failure to set error in one case; document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoSecurity hardening: force EXTERNAL auth in session.conf on Unix
Simon McVittie [Tue, 12 May 2015 10:10:58 +0000 (11:10 +0100)]
Security hardening: force EXTERNAL auth in session.conf on Unix

DBUS_COOKIE_SHA1 is dependent on unguessable strings, i.e.
indirectly dependent on high-quality pseudo-random numbers
whereas EXTERNAL authentication (credentials-passing)
is mediated by the kernel and cannot be faked.

On Windows, EXTERNAL authentication is not available,
so we continue to use the hard-coded default (all
authentication mechanisms are tried).

Users of tcp: or nonce-tcp: on Unix will have to comment
this out, but they would have had to use a special
configuration anyway (to set the listening address),
and the tcp: and nonce-tcp: transports are inherently
insecure unless special steps are taken to have them
restricted to a VPN or SSH tunnelling.

Users of obscure Unix platforms (those that trigger
the warning "Socket credentials not supported on this Unix OS"
when compiling dbus-sysdeps-unix.c) might also have to
comment this out, or preferably provide a tested patch
to enable credentials-passing on that OS.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agostart towards 1.8.20
Simon McVittie [Thu, 14 May 2015 13:30:08 +0000 (14:30 +0100)]
start towards 1.8.20

9 years ago1.8.18 sandbox/jacekbe/upstream
Simon McVittie [Thu, 14 May 2015 12:28:38 +0000 (13:28 +0100)]
1.8.18

9 years agodbus_daemon_publish_session_bus_address: Fix -Wsign-compare issue.
Ralf Habacker [Wed, 13 May 2015 18:17:05 +0000 (20:17 +0200)]
dbus_daemon_publish_session_bus_address: Fix -Wsign-compare issue.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoNEWS
Simon McVittie [Wed, 13 May 2015 17:52:23 +0000 (18:52 +0100)]
NEWS

9 years agoAvoid reading beyond the length of a variable
Simon McVittie [Tue, 27 Aug 2013 18:16:42 +0000 (19:16 +0100)]
Avoid reading beyond the length of a variable

Appending &some as DBUS_TYPE_INT64, DBUS_TYPE_UINT64 or DBUS_TYPE_DOUBLE,
where "some" is an int, reads beyond the bounds of that variable.
Use a zero-filled DBusBasicValue instead.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30350

9 years agoFix whitespace as per Havoc's review (in 2010)
Simon McVittie [Tue, 27 Aug 2013 17:21:03 +0000 (18:21 +0100)]
Fix whitespace as per Havoc's review (in 2010)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30350

9 years agoImplement dbus_message_iter_get_element_count
Christian Dywan [Thu, 23 Sep 2010 17:22:53 +0000 (19:22 +0200)]
Implement dbus_message_iter_get_element_count

According unit tests are added to _dbus_message_test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=30350
Reviewed-by: Havoc Pennington <hp@pobox.com>
9 years agoDBusSocket: put the #ifdef case before the !defined case
Simon McVittie [Fri, 17 Apr 2015 13:01:08 +0000 (14:01 +0100)]
DBusSocket: put the #ifdef case before the !defined case

This avoids the confusing #ifndef...#else anti-pattern.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agoConvert mostly DBUS_SOCKET_... and DBUS_POLLABLE_.. macros for more type safety.
Ralf Habacker [Thu, 16 Apr 2015 21:16:31 +0000 (23:16 +0200)]
Convert mostly DBUS_SOCKET_... and DBUS_POLLABLE_.. macros for more type safety.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoTurn DBusSocket into a type-safe struct, preventing inappropriate conversion
Simon McVittie [Thu, 12 Mar 2015 20:44:42 +0000 (20:44 +0000)]
Turn DBusSocket into a type-safe struct, preventing inappropriate conversion

Fix the remaining platform-specific code to look at the struct's
appropriate platform-specific member.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444

9 years agoRemove _dbus_socket_is_invalid, no longer used
Simon McVittie [Thu, 12 Mar 2015 18:44:48 +0000 (18:44 +0000)]
Remove _dbus_socket_is_invalid, no longer used

It didn't have many users anyway, and I've replaced them with the
DBUS_SOCKET_IS_VALID macro.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agoConvert miscellaneous socket APIs to DBusSocket
Simon McVittie [Thu, 12 Mar 2015 18:35:48 +0000 (18:35 +0000)]
Convert miscellaneous socket APIs to DBusSocket

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agogeneric socket transport code: work in terms of DBusSocket
Simon McVittie [Thu, 12 Mar 2015 18:33:46 +0000 (18:33 +0000)]
generic socket transport code: work in terms of DBusSocket

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agoSplit _dbus_set_fd_nonblocking vs. _dbus_set_socket_nonblocking
Simon McVittie [Thu, 12 Mar 2015 20:16:46 +0000 (20:16 +0000)]
Split _dbus_set_fd_nonblocking vs. _dbus_set_socket_nonblocking

The former is Unix-specific, the latter is also portable to Windows.
On Unix, they're really the same thing.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agomain: reload_pipe is (despite its name) a socket pair
Simon McVittie [Thu, 12 Mar 2015 18:29:40 +0000 (18:29 +0000)]
main: reload_pipe is (despite its name) a socket pair

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agoDBusMainLoop, DBusSocketSet: work in terms of DBusPollable
Simon McVittie [Thu, 12 Mar 2015 15:21:40 +0000 (15:21 +0000)]
DBusMainLoop, DBusSocketSet: work in terms of DBusPollable

This requires generic support for keying hash tables by DBusPollable:
there are already implementations for int and uintptr_t keys, but not
for "int or uintptr_t depending on platform", which is what
DBusPollable now means.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444

9 years agoMostly remove the remnants of an older socket abstraction layer
Simon McVittie [Thu, 12 Mar 2015 14:59:54 +0000 (14:59 +0000)]
Mostly remove the remnants of an older socket abstraction layer

This is only used on Windows, and wasn't even a particularly abstract
abstraction.

I've removed DBUS_SOCKET_IS_INVALID in favour of DBUS_SOCKET_IS_VALID
because I prefer to avoid double-negatives.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agodbus-sysdeps: add more infrastructure around DBusSocket
Simon McVittie [Thu, 12 Mar 2015 19:54:25 +0000 (19:54 +0000)]
dbus-sysdeps: add more infrastructure around DBusSocket

This is all trivial right now, but will become significant when we
change DBusSocket into a type-safe struct.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agobus_unix_fds_passing_test: the results of _dbus_socketpair are sockets
Simon McVittie [Thu, 12 Mar 2015 14:29:38 +0000 (14:29 +0000)]
bus_unix_fds_passing_test: the results of _dbus_socketpair are sockets

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agoUse typedef DBusSocket for sockets fd's to avoid conversion warnings.
Ralf Habacker [Tue, 31 Mar 2015 19:53:22 +0000 (21:53 +0200)]
Use typedef DBusSocket for sockets fd's to avoid conversion warnings.

[smcv: remove unneeded and invalid dbus-sysdeps.h from public header;
make prototype of _dbus_socketpair() consistent; undo conversion
of getaddrinfo result from int to SOCKET; don't call
_dbus_return_val_if_fail() from internal function]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444

9 years agoSecurity hardening: force EXTERNAL auth in session.conf on Unix
Simon McVittie [Tue, 12 May 2015 10:54:50 +0000 (11:54 +0100)]
Security hardening: force EXTERNAL auth in session.conf on Unix

DBUS_COOKIE_SHA1 is dependent on unguessable strings, i.e.
indirectly dependent on high-quality pseudo-random numbers
whereas EXTERNAL authentication (credentials-passing)
is mediated by the kernel and cannot be faked.

On Windows, EXTERNAL authentication is not available,
so we continue to use the hard-coded default (all
authentication mechanisms are tried).

Users of tcp: or nonce-tcp: on Unix will have to comment
this out, but they would have had to use a special
configuration anyway (to set the listening address),
and the tcp: and nonce-tcp: transports are inherently
insecure unless special steps are taken to have them
restricted to a VPN or SSH tunnelling.

Users of obscure Unix platforms (those that trigger
the warning "Socket credentials not supported on this Unix OS"
when compiling dbus-sysdeps-unix.c) might also have to
comment this out, or preferably provide a tested patch
to enable credentials-passing on that OS.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414

9 years agoreader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773).
Ralf Habacker [Wed, 6 May 2015 10:09:19 +0000 (12:09 +0200)]
reader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773).

This patch is based on the fix for 'Field reader.array_len_offset is
uninitialized'

Reported by Coverity: CID 54754, 54772, 54773: Uninitialized scalar
variable (UNINIT)

[smcv: also re-order how the class is set when we recurse, so that
the sub-reader's class doesn't end up NULL]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Fri, 8 May 2015 14:37:58 +0000 (15:37 +0100)]
Merge branch 'dbus-1.8'

9 years agoRevert "reader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772...
Simon McVittie [Fri, 8 May 2015 14:36:19 +0000 (15:36 +0100)]
Revert "reader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773)."

This reverts commit 21a7873f20145d561c2de8f084d98200a8de2c83.

This appears to cause a segfault, presumably resulting from something
assuming that reader_init() would not reinitialize all fields:

 #0  0x00007ffff7b74777 in _dbus_type_reader_get_current_type (reader=reader@entry=0x7fffffffda50) at .../dbus/dbus-marshal-recursive.c:791
 #1  0x00007ffff7b719d0 in _dbus_header_cache_check (header=<optimized out>)
    at .../dbus/dbus-marshal-header.c:209
 #2  0x00007ffff7b719d0 in _dbus_header_cache_check (header=header@entry=0x624658, field=field@entry=6) at .../dbus/dbus-marshal-header.c:250
 #3  0x00007ffff7b72884 in _dbus_header_get_field_basic (header=header@entry=0x624658, field=field@entry=6, type=type@entry=115, value=value@entry=0x7fffffffdbd8) at .../dbus/dbus-marshal-header.c:1365
 #4  0x00007ffff7b7d8c2 in dbus_message_get_destination (message=message@entry=0x624650) at .../dbus/dbus-message.c:3457
 #5  0x00007ffff7b67be6 in _dbus_connection_send_preallocated_unlocked_no_update (connection=connection@entry=0x6236d0, preallocated=0x0,
    preallocated@entry=0x6234c0, message=message@entry=0x624650, client_serial=client_serial@entry=0x7fffffffdcbc)
    at .../dbus/dbus-connection.c:2017

9 years agoauth_set_unix_credentials: Fix calling _dbus_credentials_add_pid without checking...
Ralf Habacker [Tue, 5 May 2015 15:10:01 +0000 (17:10 +0200)]
auth_set_unix_credentials: Fix calling _dbus_credentials_add_pid without checking return value (CID 54708).

Reported by Coverity: CID 54708: Unchecked return value (CHECKED_RETURN)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoauth_set_unix_credentials: Fix calling _dbus_credentials_add_unix_uid without checkin...
Ralf Habacker [Tue, 5 May 2015 15:08:18 +0000 (17:08 +0200)]
auth_set_unix_credentials: Fix calling _dbus_credentials_add_unix_uid without checking return value (CID 54722).

Reported by Coverity: CID 54722: Unchecked return value (CHECKED_RETURN)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMerge remote-tracking branch 'origin/dbus-1.8'
Ralf Habacker [Wed, 6 May 2015 10:14:31 +0000 (12:14 +0200)]
Merge remote-tracking branch 'origin/dbus-1.8'

9 years agoreader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773).
Ralf Habacker [Wed, 6 May 2015 10:09:19 +0000 (12:09 +0200)]
reader_init: Initialize all fields of struct DBusTypeReader (CID 54754, 54772, 54773).

This patch is based on the fix for 'Field reader.array_len_offset is uninitialized'

Reported by Coverity: CID 54754, 54772, 54773: Uninitialized scalar variable (UNINIT)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agodo_check_nonce: Fix of calling _dbus_string_append_len without checking return value...
Ralf Habacker [Wed, 6 May 2015 07:18:20 +0000 (09:18 +0200)]
do_check_nonce: Fix of calling _dbus_string_append_len without checking return value (CID 54720).

Reported by Coverity: CID: Unchecked return value (CHECKED_RETURN)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agodbus_message_demarshal: Fix calling _dbus_string_append_len without checking return...
Ralf Habacker [Wed, 6 May 2015 06:25:20 +0000 (08:25 +0200)]
dbus_message_demarshal: Fix calling _dbus_string_append_len without checking return value (CID 54690).

Reported by Coverity: CID 54690: Unchecked return value (CHECKED_RETURN)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoUpdate NEWS for 1.9 branch
Simon McVittie [Tue, 5 May 2015 11:50:20 +0000 (12:50 +0100)]
Update NEWS for 1.9 branch

9 years agoMerge branch 'dbus-1.8'
Simon McVittie [Tue, 5 May 2015 11:50:11 +0000 (12:50 +0100)]
Merge branch 'dbus-1.8'

9 years agoNEWS for 1.8 branch
Simon McVittie [Tue, 5 May 2015 11:43:47 +0000 (12:43 +0100)]
NEWS for 1.8 branch

9 years agoDBusCounter: add a mutex to protect the refcount and notify function
Adrian Szyndela [Tue, 5 May 2015 11:30:30 +0000 (12:30 +0100)]
DBusCounter: add a mutex to protect the refcount and notify function

The overall problem here is that DBusCounter is indirectly linked
to a DBusConnection, but is not actually guaranteed to be protected by
that connection's mutex; and a DBusMessage can carry a reference to the
DBusCounter, resulting in freeing that DBusMessage having an effect on
the DBusCounter.

Making the refcount atomic would not be a sufficient fix, since it would
not protect the notify function: _dbus_counter_notify() could be called
indirectly by dbus_message_unref(), in an arbitrary thread that does not
hold the DBusConnection's lock, at the same time that the holder
of the DBusConnection lock calls _dbus_transport_set_max_message_size().

[smcv: added commit message]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89297
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoextend lock's range in live_messages_notify()
Adrian Szyndela [Tue, 5 May 2015 11:27:15 +0000 (12:27 +0100)]
extend lock's range in live_messages_notify()

The other code paths that ref or unref a transport are protected by
the DBusConnection's lock. This function already used that lock,
but for a narrower scope than the refcount manipulation.

live_messages_notify() could be triggered by unreffing messages
that originated from the same connection in a different thread.

[smcv: added commit message]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90312
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agotools: MSVC compile fixes
Ralf Habacker [Tue, 28 Apr 2015 18:11:27 +0000 (20:11 +0200)]
tools: MSVC compile fixes

unistd.h and sleep() are normally Unix-specific, although mingw also provides them.
The Windows C runtime documents _environ as its equivalent of Unix environ.

https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMerge remote-tracking branch 'origin/dbus-1.8'
Ralf Habacker [Fri, 1 May 2015 21:08:43 +0000 (23:08 +0200)]
Merge remote-tracking branch 'origin/dbus-1.8'

Conflicts:
cmake/test/CMakeLists.txt
test/Makefile.am

9 years agotest_command_line_internal: Fix variable original_argv going out of scope leaks the...
Ralf Habacker [Tue, 21 Apr 2015 12:14:26 +0000 (14:14 +0200)]
test_command_line_internal: Fix variable original_argv going out of scope leaks the storage it points to (CID 60588).

Reported by Coverity: CID 60588: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agotest_remove_directory: Fix 'variable iter going out of scope leaks the storage it...
Ralf Habacker [Mon, 20 Apr 2015 20:14:06 +0000 (22:14 +0200)]
test_remove_directory: Fix 'variable iter going out of scope leaks the storage it points to' (CID 54729)

Reported by Coverity: CID 54729: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agotest_command_line_internal: Fix 'variable shell_argv going out of scope leaks the...
Ralf Habacker [Mon, 20 Apr 2015 19:55:27 +0000 (21:55 +0200)]
test_command_line_internal: Fix 'variable shell_argv going out of scope leaks the storage it points to' (CID 54751)

Reported by Coverity: CID 54751: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agodbus_test_tool_spam: Fix 'variable payload going out of scope leaks the storage it...
Ralf Habacker [Mon, 20 Apr 2015 19:47:21 +0000 (21:47 +0200)]
dbus_test_tool_spam: Fix 'variable payload going out of scope leaks the storage it points to' (CID 54759)

Reported by Coverity: CID 54759: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agodbus_test_tool_spam: Fix 'variable random_sizes going out of scope leaks the storage...
Ralf Habacker [Mon, 20 Apr 2015 19:40:14 +0000 (21:40 +0200)]
dbus_test_tool_spam: Fix 'variable random_sizes going out of scope leaks the storage it points to' (CID 54761)

Reported by Coverity: CID 54761: Resource leak (RESOURCE_LEAK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agodbus_server_set_auth_mechanisms: Fix returning without unlocking server->mutex->lock...
Ralf Habacker [Wed, 22 Apr 2015 12:47:08 +0000 (14:47 +0200)]
dbus_server_set_auth_mechanisms: Fix returning without unlocking server->mutex->lock (CID 54749).

Reported by Coverity: CID 54749: Missing unlock (LOCK)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agocmake: Give users a hint to run autogen.sh if config.h.in is not present to see autot...
Ralf Habacker [Thu, 5 Mar 2015 19:48:09 +0000 (20:48 +0100)]
cmake: Give users a hint to run autogen.sh if config.h.in is not present to see autotools config header differences.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoFix msvc sign-compare warning on Windows7 64bit by adding a type cast.
Ralf Habacker [Mon, 20 Apr 2015 10:35:53 +0000 (12:35 +0200)]
Fix msvc sign-compare warning on Windows7 64bit by adding a type cast.

The related warning is: C4267: 'function' : conversion from 'size_t' to 'int', possible loss of data.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agocmake: Add msvc support for sign-compare warnings.
Ralf Habacker [Sat, 18 Apr 2015 19:54:05 +0000 (21:54 +0200)]
cmake: Add msvc support for sign-compare warnings.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agocmake: Dump missing config header checks only if config.h.in is present.
Ralf Habacker [Sat, 18 Apr 2015 19:14:11 +0000 (21:14 +0200)]
cmake: Dump missing config header checks only if config.h.in is present.

config.h.in is only generated by running autogen.sh.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90089
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoAlways assert that BUS_CONNECTION_DATA() returns non-NULL
Ralf Habacker [Tue, 14 Apr 2015 21:17:40 +0000 (23:17 +0200)]
Always assert that BUS_CONNECTION_DATA() returns non-NULL

Every DBusConnection in the dbus-daemon should have been through
bus_connections_setup_connection(), so we can assert that the
BusConnectionData has been attached to it. Having this assertion
is enough to hint to Coverity that it does not need to worry about
whether this pointer might be NULL.

In regression tests, we do work with a few fake client-side
DBusConnection instances in the same process; but it would be a
serious bug if we mixed those up with the ones processed by
dbus-daemon's real code, so the assertion is still valid.

This patch has been inspired by (and fixes) the following coverity scan issues:
CID 54846: Dereference null return value (NULL_RETURNS).
CID 54854: Dereference null return value (NULL_RETURNS).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
[smcv: fixed -Wdeclaration-after-statement; more informative commit message]
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
9 years agoinclude_dir: skip processing on error (CID 54744)
Ralf Habacker [Tue, 14 Apr 2015 21:48:23 +0000 (23:48 +0200)]
include_dir: skip processing on error (CID 54744)

We already skipped processing for DBUS_ERROR_FILE_NOT_FOUND;
but if the error was something else, we would pass the NULL
pointer dir to _dbus_directory_get_next_file(), which dereferences it.
Reported by Coverity: CID 54744: Dereference after null check (FORWARD_NULL)

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
[smcv: re-worded commit message]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMove Autoconf/Automake droppings into /build-aux/
Simon McVittie [Wed, 4 Mar 2015 10:37:49 +0000 (10:37 +0000)]
Move Autoconf/Automake droppings into /build-aux/

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoRun name-test tests under the TAP driver
Simon McVittie [Wed, 1 Apr 2015 12:27:46 +0000 (13:27 +0100)]
Run name-test tests under the TAP driver

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoname-test: remove unused die function
Simon McVittie [Wed, 1 Apr 2015 12:27:06 +0000 (13:27 +0100)]
name-test: remove unused die function

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoRun most tests under the TAP driver, with a simple adaptor for non-TAP tests
Simon McVittie [Mon, 2 Mar 2015 12:36:16 +0000 (12:36 +0000)]
Run most tests under the TAP driver, with a simple adaptor for non-TAP tests

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agodbus-run-session(1): document modern Automake syntax
Simon McVittie [Wed, 1 Apr 2015 12:10:37 +0000 (13:10 +0100)]
dbus-run-session(1): document modern Automake syntax

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoname-test: also switch to AM_TESTS_ENVIRONMENT here
Simon McVittie [Wed, 1 Apr 2015 12:07:36 +0000 (13:07 +0100)]
name-test: also switch to AM_TESTS_ENVIRONMENT here

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoChange syntax of AM_TESTS_ENVIRONMENT to what the Automake docs prefer
Simon McVittie [Wed, 1 Apr 2015 12:07:19 +0000 (13:07 +0100)]
Change syntax of AM_TESTS_ENVIRONMENT to what the Automake docs prefer

On closer inspection of Automake docs, this is how AM_TESTS_ENVIRONMENT
is actually meant to work; the parallel test driver is even less
compatible with the old serial test driver than I'd realised :-(

Also, according to <http://www.unix.com/man-page/POSIX/1posix/export>,
"export FOO=bar" is actually required functionality for POSIX shells,
and is not a bashism. The Autoconf documentation mentions Solaris 10
as an example of somewhere this doesn't work... but at this point
I'd prefer to say "compiling dbus requires a POSIX shell".

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoDepend on Automake 1.13 so we can use the correct AM_TESTS_ENVIRONMENT
Simon McVittie [Mon, 2 Mar 2015 11:46:13 +0000 (11:46 +0000)]
Depend on Automake 1.13 so we can use the correct AM_TESTS_ENVIRONMENT

Since Automake 1.13 (released December 2012) the correct way for a
maintainer to specify environment variables has been
AM_TESTS_ENVIRONMENT, with TESTS_ENVIRONMENT reserved for the user.
That doesn't work in older Automake, so drop support for such old
versions.

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoinstalled-tests: don't set DBUS_TEST_HOME which is misleading
Simon McVittie [Thu, 26 Feb 2015 17:55:45 +0000 (17:55 +0000)]
installed-tests: don't set DBUS_TEST_HOME which is misleading

It doesn't do anything - the variable I was thinking of is called
DBUS_TEST_HOMEDIR. Also, if I had spelled it correctly, the tests
would have failed, because libdbus (quite reasonably) won't create
a nonexistent $HOME to write out cookie_sha1 files in ~/.dbus_keyrings.

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoinstalled-tests: declare that the output is in TAP format
Simon McVittie [Thu, 26 Feb 2015 17:53:46 +0000 (17:53 +0000)]
installed-tests: declare that the output is in TAP format

For the ones written using GLib, the output is in TAP format if we
say --tap. For the one not written using GLib, the output is in TAP
and the command-line is ignored.

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agotest-shell, test-printf: produce TAP output like the other installable tests
Simon McVittie [Thu, 26 Feb 2015 17:39:20 +0000 (17:39 +0000)]
test-shell, test-printf: produce TAP output like the other installable tests

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agotests: provide g_test_skip() emulation for older GLib
Simon McVittie [Thu, 26 Feb 2015 17:11:19 +0000 (17:11 +0000)]
tests: provide g_test_skip() emulation for older GLib

We don't hard-depend on a new enough GLib to have g_test_skip();
if our GLib is older, fake it using g_test_message() and degrade to
reporting it as a pass rather than a skip.

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agotests: avoid noise on stdout when not --verbose
Simon McVittie [Thu, 26 Feb 2015 17:12:22 +0000 (17:12 +0000)]
tests: avoid noise on stdout when not --verbose

This makes life easier for frameworks like LAVA that screen-scrape
test results.

g_test_message() is not displayed by default, but each test can be run
with either --tap or --verbose to get these messages displayed.

Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89846

9 years agoAdd manual tcp test case.
Ralf Habacker [Wed, 28 Jan 2015 21:44:16 +0000 (22:44 +0100)]
Add manual tcp test case.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
(cherry picked from commit fa1ada44eabd62b46b89c7be22bfce6d595d8dac)

Conflicts:
cmake/test/CMakeLists.txt
test/Makefile.am

9 years agoCID 54766: Resource leak (RESOURCE_LEAK).
Ralf Habacker [Tue, 14 Apr 2015 08:01:49 +0000 (10:01 +0200)]
CID 54766: Resource leak (RESOURCE_LEAK).

Variable original_argv going out of scope leaks the storage it points to.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90021
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoMerge branch 'dbus-1.8'
Ralf Habacker [Mon, 13 Apr 2015 13:36:21 +0000 (15:36 +0200)]
Merge branch 'dbus-1.8'

Conflicts:
dbus/dbus-sysdeps-win.c

9 years agoFix 'dbus connection referencing issue in test-relay'.
Ralf Habacker [Mon, 13 Apr 2015 13:04:20 +0000 (15:04 +0200)]
Fix 'dbus connection referencing issue in test-relay'.

The watches added on connection setup should be removed on shutdown.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90005
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agoAdd newline to verbose output in _dbus_trace_ref().
Ralf Habacker [Fri, 10 Apr 2015 10:38:59 +0000 (12:38 +0200)]
Add newline to verbose output in _dbus_trace_ref().

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90004
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
9 years agocmake: Extend underlines below dbus version print on configure summary title.
Ralf Habacker [Tue, 24 Mar 2015 07:03:54 +0000 (08:03 +0100)]
cmake: Extend underlines below dbus version print on configure summary title.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>