Commit graph

4417 commits

Author SHA1 Message Date
Ralf Habacker
1d2976e4bd 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>
2015-05-01 23:04:59 +02:00
Ralf Habacker
580b44f72d 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>
2015-05-01 23:04:52 +02:00
Ralf Habacker
08e2b81062 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>
2015-04-28 22:57:45 +02:00
Ralf Habacker
1ba6c3956b 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>
2015-04-20 23:27:37 +02:00
Ralf Habacker
449b5b9bfa 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>
2015-04-20 13:25:54 +02:00
Ralf Habacker
b43ad50be7 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>
2015-04-20 12:26:12 +02:00
Ralf Habacker
b7086e0513 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>
2015-04-20 12:25:32 +02:00
Ralf Habacker
d5e7e2794e 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>
2015-04-17 13:07:05 +01:00
Ralf Habacker
26a3c0dc5b 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>
2015-04-16 13:15:19 +01:00
Simon McVittie
15e6b4f5b5 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
2015-04-16 13:06:33 +01:00
Simon McVittie
0de568e52b 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
2015-04-16 13:06:32 +01:00
Simon McVittie
56e1448bed 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
2015-04-16 13:06:31 +01:00
Simon McVittie
4f4801346e 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
2015-04-16 13:06:29 +01:00
Simon McVittie
536c5eb7cb 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
2015-04-16 13:06:27 +01:00
Simon McVittie
46e2759883 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
2015-04-16 13:06:26 +01:00
Simon McVittie
bb4b586d7c 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
2015-04-16 13:06:21 +01:00
Simon McVittie
4e29ece664 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
2015-04-16 13:06:19 +01:00
Simon McVittie
03da0fefd7 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
2015-04-16 13:06:17 +01:00
Simon McVittie
d752d07a54 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
2015-04-16 13:06:16 +01:00
Simon McVittie
58eefa1031 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
2015-04-16 13:06:13 +01:00
Simon McVittie
a6b68598c4 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
2015-04-16 13:06:07 +01:00
Simon McVittie
b7e56c18a9 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
2015-04-16 13:05:37 +01:00
Ralf Habacker
620ca3ebe4 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 fa1ada44ea)

Conflicts:
	cmake/test/CMakeLists.txt
	test/Makefile.am
2015-04-15 12:19:57 +02:00
Ralf Habacker
54f92110f6 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>
2015-04-14 19:51:33 +02:00
Ralf Habacker
718843d351 Merge branch 'dbus-1.8'
Conflicts:
	dbus/dbus-sysdeps-win.c
2015-04-13 15:41:08 +02:00
Ralf Habacker
c225ff8330 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>
2015-04-13 15:31:28 +02:00
Ralf Habacker
96e02c5dc6 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>
2015-04-13 15:31:17 +02:00
Ralf Habacker
4101e0bc6c 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>
2015-03-24 08:38:58 +01:00
Simon McVittie
7647179096 Fix assorted compiler warnings on Windows.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[rh: rebased because a few hunks have already been applied with commit
 92c39d1d8a]
2015-03-24 08:27:09 +01:00
Ralf Habacker
73af0d5d5c Rename _dbus_full_duplex_pipe() to more descriptive name _dbus_socketpair().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-24 08:13:36 +01:00
Simon McVittie
21c41b3eb0 cmake: only set CMP0053, CMP0054 on CMake >= 3.1
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-03-24 08:10:10 +01:00
Ralf Habacker
92c39d1d8a Fix of 'warning: variable ‘..‘ set but not used [-Wunused-but-set-variable]'.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-17 16:52:51 +01:00
Ralf Habacker
40a6b6e815 Revert "Rename _dbus_full_duplex_pipe() to more descriptive name _dbus_socketpair()."
This reverts commit ee0e15366c.
2015-03-11 15:56:58 +01:00
Ralf Habacker
dfaf56e922 Revert "Use typedef DBusSocket for sockets fd's to avoid conversion warnings."
This reverts commit f9192688b6.
2015-03-11 15:42:51 +01:00
Ralf Habacker
72f246f87d cmake: opt-in to not implicitly expanding variables in if() (policy CMP0054)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-11 15:42:39 +01:00
Ralf Habacker
f756aead90 Revert "cmake: @VAR@ substitutions in set() are deprecated, use string(CONFIGURE) instead (policy CMP0053)"
This reverts commit 45f2e84a7d.
2015-03-11 15:40:10 +01:00
Ralf Habacker
f9192688b6 Use typedef DBusSocket for sockets fd's to avoid conversion warnings.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
2015-03-11 15:22:57 +01:00
Ralf Habacker
ee0e15366c Rename _dbus_full_duplex_pipe() to more descriptive name _dbus_socketpair().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89444
2015-03-11 15:22:57 +01:00
Ralf Habacker
45f2e84a7d cmake: @VAR@ substitutions in set() are deprecated, use string(CONFIGURE) instead (policy CMP0053)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-06 20:36:45 +01:00
Ralf Habacker
d46f7bac0d cmake: @VAR@ substitutions in set() are deprecated, use string(CONFIGURE) instead (policy CMP0053)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-06 20:35:59 +01:00
Ralf Habacker
924bff39e6 cmake: stop using deprecated LOCATION property (policy CMP0026)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-06 20:32:30 +01:00
Ralf Habacker
5d8f82d638 Fix cmake build system bug not generating versioned library name in case LT_REVISION is zero.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89450
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-06 20:29:36 +01:00
Ralf Habacker
ee9c52ca33 Add missing include file for cmake function check_include_files() (commit 2d2b5af) 2015-03-05 14:45:18 +01:00
Simon McVittie
58f66e6c40 dbus-print-message: conditionalize Unix FD handling on DBUS_UNIX
We close() the fd after we have printed it, but close() isn't
standard functionality on Windows. Unix FD-passing is never going
to work on non-Unix platforms anyway.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-03-05 13:15:00 +00:00
Simon McVittie
188884dd62 dbus-monitor: use _dbus_get_real_time instead of gettimeofday
gettimeofday is implicitly declared (i.e. not in our #include'd header
files) when cross-compiling for on Windows. Now that fd.o#83115
has been fixed, using _dbus functions is not a problem.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89428
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-03-05 13:14:37 +00:00
Simon McVittie
49d67163da Improve diagnostics when UpdateActivationEnvironment calls are rejected
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88812
Reviewed-by: Colin Walters <walters@verbum.org>
[smcv: rebased to not require the extra code initially on that bug]
2015-03-05 13:09:07 +00:00
Ralf Habacker
e488588501 Keep cmake generated defines for include files in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 14:05:59 +01:00
Ralf Habacker
cd8524ce00 Move include file checks to ConfigureChecks.cmake for cmake build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 13:54:15 +01:00
Ralf Habacker
939b3d97ee Add check to cmake build system if config.h.cmake is in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 13:54:10 +01:00
Ralf Habacker
add6b4f554 Keep include file checks in sync with autotools.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85418
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-03-05 13:54:04 +01:00