Commit graph

4089 commits

Author SHA1 Message Date
Simon McVittie
d7b3dba1bd 1.9.8 development release 2015-02-03 19:36:07 +00:00
Simon McVittie
3cf71c2707 Treat root as a valid candidate for TEST_USER_ME
If spawn_dbus_daemon() can fail for TEST_USER_ME, then we'd have to
go through all the tests adding the ability to skip tests after
it fails, which is a fairly extensive change.

The tests have historically all run as whatever uid is supplied, and
if the tests are being run as root for some reason - perhaps in a CI
framework for an embedded platform that doesn't have non-root users,
or in an environment where you can be root or non-root but not both -
there is no particular reason to skip them.
2015-02-03 19:35:39 +00:00
Simon McVittie
b1c54b5a75 NEWS 2015-02-03 16:25:56 +00:00
Simon McVittie
cf35dad25a Add a regression test for systemd activation
4.5 years after it was implemented, here is the regression test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57952
Reviewed-by: Philip Withnall
2015-02-03 16:20:01 +00:00
Simon McVittie
652a324fb6 bus_context_log_and_set_error: add and use
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:24 +00:00
Simon McVittie
c6e024834b _dbus_set_error_valist: add
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:20 +00:00
Simon McVittie
3861a42655 bus_context_log_literal: add simplified version of bus_context_log
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:17 +00:00
Simon McVittie
5b89e2a839 bus: put the printf attribute in the header where it will do more good
Now we can actually notice incorrect format strings in other
translation units.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:14 +00:00
Simon McVittie
1f716452e7 bus driver: factor out bus_driver_check_caller_is_privileged, and allow root
Unlike the initial mitigation for CVE-2014-8148, we now allow
uid 0 to call UpdateActivationEnvironment. There's no point in root
doing that, but there's also no reason why it's particularly bad -
if an attacker is uid 0 we've already lost - and it simplifies
use of this function for future things that do want to be callable
by root, like BecomeMonitor for #46787.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:11 +00:00
Simon McVittie
98ae1149ad Add a test for uid-controlled permissions
This is technical debt from mitigating CVE-2014-8148, which should
really have had a regression test at the time.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:08 +00:00
Simon McVittie
6a49ced2dd Add infrastructure to run bits of tests under an alternative uid
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:05 +00:00
Simon McVittie
1e21cc86bf test: implement GLib-style "installed tests"
We run each test twice:

* once with the system's session.conf, as an integration test
  (test-cases that need a special configuration are automatically
  skipped)
* once with our special test configuration files, which provide better
  coverage

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:01 +00:00
Simon McVittie
ee032f5a11 Generate test configuration files via build-time sed, not configure
This means we can generate a version that works when installed,
from the same source files.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:19:00 +00:00
Simon McVittie
8b238f3f0d Factor out some utility functions from test/dbus-daemon*
In the process, make test_kill_pid() safer: do not try to terminate
more than one pid, or the NULL handle.

Also stop leaking the address_fd in spawn_dbus_daemon, a pre-existing
bug that was spotted by Philip Withnall during review.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:18:57 +00:00
Simon McVittie
6976a7f199 Bump required GLib version to 2.36
This is for g_close(), which the next commit will use. It also lets us
rely on g_type_init() being a no-op (since 2.32 the type system is
always initialized by a global constructor).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
2015-02-03 16:18:47 +00:00
Lukasz Skalski
9668c61726 Update .gitignore files
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88943
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-02-03 15:40:01 +00:00
Simon McVittie
9e0f5ae7d3 NEWS 2015-02-02 18:52:08 +00:00
Simon McVittie
1acc7b09ed lcov: use builddir, not srcdir
It seems lcov (or gcc?) has changed its paths since last time this
worked.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88808
Reviewed-by: Philip Withnall
2015-02-02 18:38:07 +00:00
Simon McVittie
7cf5d2fac4 Enable subdir-objects Automake option
It has been supported since at least 1.10, and its absence is
deprecated since 1.14.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88808
Reviewed-by: Philip Withnall
2015-02-02 18:38:07 +00:00
Simon McVittie
ef06f2a233 bus: exit on fatal errors even if not syslogging
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88808
Reviewed-by: Philip Withnall
2015-02-02 18:38:07 +00:00
Ralf Habacker
795ea3007e Fix 'dbus-daemon on Windows: Failed to bind socket "localhost:xxxx": Address already in use'.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-30 22:07:10 +01:00
Ralf Habacker
91dbd2eff5 In _dbus_listen_tcp_socket() set socket family to ipv4 in unspecified case for now.
This fix is required to support at least ipv4 tcp support calling
_dbus_listen_tcp_socket() without family.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-30 20:29:49 +01:00
Ralf Habacker
fa1ada44ea Add manual tcp test case.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87999
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-30 09:33:40 +01:00
Simon McVittie
b5bf338953 _dbus_string_append_printf_valist: avoid leaking copy of varargs
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88087
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-29 12:09:40 +00:00
Simon McVittie
04056bba41 Use pygi instead of pygobject 2
pygobject 2 is obsolete and unmaintained, and anyway this is for
optional functionality (full regression test coverage) rather than
anything that will be needed in production builds.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85969
2015-01-27 14:29:59 +00:00
Thiago Macieira
180f3a8061 Fix build with --enable-maintainer-mode --disable-embedded-tests
Otherwise, we get:
dbus/dbus-object-tree.c:323:1: error: 'find_subtree' defined but not used [-Werror=unused-function]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=87837
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-27 14:18:03 +00:00
Simon McVittie
254b47aa68 When generating random messages, exercise empty signature as intended
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88089
2015-01-06 22:45:27 +00:00
Simon McVittie
778c4ee281 _dbus_marshal_validate_test: test both /foo/ and foo/
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88089
2015-01-06 22:45:27 +00:00
Simon McVittie
c89cbed909 selinux: avoid leaking on systems where va_start allocates memory
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88087
2015-01-06 22:12:27 +00:00
Simon McVittie
1650d77bf1 Fix assertion in regression test to be equality test, not assignment
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88088
2015-01-06 22:08:47 +00:00
Simon McVittie
4a7cb0cb6f Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2015-01-05 15:00:45 +00:00
Simon McVittie
d97e8f95aa dbus-1.9.6
-----BEGIN PGP SIGNATURE-----
 
 iQIVAwUAVKql4E3o/ypjx8yQAQhvWQ//RYjifPkMdE9ppXQsuLH65laZihPo04Fy
 KqZapj7VUtFShJYB1MdAkvqi3+r/OtIg9pfEg23XB+va24/otZBxgi/r+1Bqi3ww
 XJLHPeEFWVIARbbOFEa3QuUkJa/rhfgVxpj+b41UC7P772YmXcwOAlNhi/mlgxP9
 HGU54e2ANM70/ineMHBM+MjRvxhs67fsZ+IDd3JPpF+W9U5x1OSwPGLx4LwAbKUm
 PIxCLbw9A7zoDOCMUrQyO1SE2q/E9W/UShwMQWppFsyBbyfr7lIaTZSQx+af/eI6
 RXsZVMFLIWXBIS8OoQWKDP3zaTJPvlqI1KUjsCpAUrBI+ExHYauigX9GD+W1T86X
 I+BTFVL60XofCWws4ztk38wvzVYAgc3BW7aiLnl5d2UNIPMGZH2hFwMOxbyexINM
 gbShSyhNVnN0uzpWZzrKqf2JG1NWmPqxoVaOtfHF1T+dbZv2FTbk6jSMzavlzAHZ
 WVVlRWA+0hG4GCd8mSrFbncGwyfgqgfBxXpMVeaqhoiHAixwqT/y8HidTLHnhEHM
 rNOgJrbF8Xd+Tzgh5VS8IGXZeY8Q3JM3QS5TstzJd5pSohQaE6UpPoIuhS1YGzmL
 4YK/wUB6+EKh5p22f1H+VtIanq+l4b1bYok3pNnJhAcYmzHt5YRe3DAt3UBH9ACg
 c6iQqVwZ/fc=
 =jedl
 -----END PGP SIGNATURE-----

Merge tag 'dbus-1.9.6'

dbus-1.9.6

Conflicts:
	NEWS
	configure.ac
2015-01-05 14:58:48 +00:00
Simon McVittie
a559ed3508 1.8.15 2015-01-05 14:57:26 +00:00
Simon McVittie
9a8bf9d810 dbus-1.8.14
-----BEGIN PGP SIGNATURE-----
 
 iQIVAwUAVKql8U3o/ypjx8yQAQjkMRAAoFSUlMmZF52fRX/LIsLmsAU6btzYgU0A
 Bj+JbpSCLBBd+Te0WDHugSol63cAbI+SWTxkdl0K/1+Bsr4MUEcMTf+6yVHArte4
 +zUs2DAPrK7LYU6U2qiVWmIn3tBS7vf6RiGiqBZu0nm+//lc5IO7M31uVbXaiT/X
 03wQ+RPV0J715wkNZTi1t+yTStRtGbuw7rTxYPtgJOa1fuOxGGh07wPFJUc/gbU3
 kq9XSAsqDmDQjh1cufbnJOB+lsxAj8AYlz7Lb8O1nM1AwyuJa3CO4bk37XqFTxk9
 q6rocequK/MeN3f3hMAQkEF4c1nq/9ibKeE+Pn1qZ+yUSPxXqjsdvlxEdbS5wx5R
 q5A1z27o5b1KitMWSlMxzgwx2BP2oM/gDU1HuEIfFztE0HjLOc+pS1cv8iTojTVT
 rzLqcNrhDCcZT9ocC/Y428y+WwYPEcjhuVB9TYo2Q42/Czexz0394Aze1lZzDtkl
 E1Fz0o0PuYMjFh7E0VGQHGfucVJMLZE/pXwYafSU47R1htErhr/3se/CYn0SfUBN
 9wkA9/E+V/7US2qdNOEfe8dx0y610Sk5y8BOW/AGIANTQjVLbQJp2lYjUnFaKgQL
 D/pYPI9viGBYr2jAmQIarPAZjljOu+F9DD3mqStn6tuxxytl4kQtNKVonJ3hxVPV
 9riJ4ce7iNM=
 =UAl+
 -----END PGP SIGNATURE-----

Merge tag 'dbus-1.8.14' into dbus-1.8

dbus-1.8.14
2015-01-05 14:56:44 +00:00
Ralf Habacker
fd4f3ca3f6 Fix usage of undefined variable DBUS_WIN32 on cmake build system
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88010
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-05 11:50:11 +01:00
Ralf Habacker
ea54a97f05 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2015-01-05 11:49:48 +01:00
Ralf Habacker
01af167b55 Windows cmake cross compile fix
We need to include 'test' subdir in any case not only when using glib.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88009
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2015-01-05 11:47:13 +01:00
Ralf Habacker
2abe9ffeb7 Fix of 'dbus-daemon can only handle 64 simultaneous connections on Windows'.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71297
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-01-05 11:47:02 +01:00
Simon McVittie
ae9d7149aa Merge branch 'dbus-1.8' and prepare 1.9.6
Conflicts:
	NEWS
	configure.ac
	test/dbus-daemon.c
2015-01-01 23:48:13 +00:00
Simon McVittie
abbbf449f1 Prepare release for Monday 2015-01-01 23:42:41 +00:00
Simon McVittie
eec885de3b Hardening: only accept Stats function calls at the canonical object path
These function calls are not a privilege escalation risk like
UpdateActivationEnvironment, but they might provide sensitive
information or be enhanced to provide sensitive information
in future, so the default system.conf locks them down to root-only.
Apply the same canonical-object-path hardening as for
UpdateActivationEnvironment.

We do not apply the uid check here because they are less dangerous
than UpdateActivationEnvironment, and because the ability to unlock
these function calls for specific uids is a documented configuration
for developers.

Reviewed-by: Thiago Macieira <thiago@kde.org>
[added missing #include; extended commit message -smcv]
2015-01-01 23:33:10 +00:00
Simon McVittie
4daf4bdc92 Add a regression test for path-based UpdateActivationEnvironment hardening
Reviewed-by: Thiago Macieira <thiago@kde.org>
2015-01-01 23:32:33 +00:00
Simon McVittie
a67cb9bf1c Hardening: only allow the uid of the dbus-daemon to call UpdateActivationEnvironment
As with the previous commit, this is probably not actually privilege
escalation due to the use of an activation helper that cleans up its
environment, but let's be extra-careful here.

Reviewed-by: Thiago Macieira <thiago@kde.org>
[adjusted commit message -smcv]
2015-01-01 23:32:22 +00:00
Simon McVittie
6a3f563a4b Hardening: reject UpdateActivationEnvironment on non-canonical path
UpdateActivationEnvironment is the one dbus-daemon API call that is
obviously dangerous (it is intended for the session bus),
so the default system.conf does not allow anyone to call it.

It has recently come to the D-Bus maintainers' attention that some
system services incorrectly install D-Bus policy rules that allow
arbitrary method calls to any destination as long as they have a
"safe" object path. This is not actually safe: some system services
that use low-level D-Bus bindings like libdbus, including dbus-daemon
itself, provide the same API on all object paths.

Unauthorized calls to UpdateActivationEnvironment are probably just
resource consumption rather than privilege escalation, because on
the system bus, the modified environment is only used to execute
a setuid wrapper that avoids LD_PRELOAD etc. via normal setuid
handling, and sanitizes its own environment before executing
the real service. However, it's safest to assume the worst and
treat it as a potential privilege escalation.

Accordingly, as a hardening measure to avoid privilege escalation on
systems with these faulty services, stop allowing calls to
("/com/example/Whatever",
"org.freedesktop.DBus.UpdateActivationEnvironment")
and only allow ("/org/freedesktop/DBus",
"org.freedesktop.DBus.UpdateActivationEnvironment").

We deliberately continue to provide read-only APIs like
GetConnectionUnixUser at all object paths, for backwards compatibility.

Reviewed-by: Thiago Macieira <thiago@kde.org>
[adjusted commit message to note that this is probably only DoS -smcv]
2015-01-01 23:32:16 +00:00
Илья А. Ткаченко
bf79b97f87 Fix GetExtendedTcpTable crash on vista sp0.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77008
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-12-23 11:02:00 +01:00
Simon McVittie
7afacaf653 1.8.13 2014-11-24 22:52:22 +00:00
Simon McVittie
fda9d8a44a 1.9.5 2014-11-24 22:51:44 +00:00
Simon McVittie
be33d75f3a Start spec 0.26 2014-11-24 22:51:11 +00:00
Simon McVittie
1e7653d749 1.9.4 2014-11-24 13:08:06 +00:00
Simon McVittie
4244d86a90 Revert "Start spec 0.26"
This reverts commit cdd9e9a65c.
2014-11-24 13:05:37 +00:00