Commit graph

3952 commits

Author SHA1 Message Date
Simon McVittie
eca7a1c5e0 NEWS for 1.9 2014-09-15 17:44:55 +01:00
Alban Crequy
c681f46c22 dbus-monitor: more details on file descriptors
Print more details when receiving a file descriptor.

Before:
   unix fd 5

After:
   file descriptor
         inode: 1030
         type: char
   file descriptor
         inode: 295664
         type: socket
         address family: unknown (16)
   file descriptor
         inode: 295665
         type: socket
         address family: inet
         name 127.0.0.1 port 47723
         peer 127.0.0.1 port 22
   file descriptor
         inode: 295666
         type: socket
         address family: unix
         name @/tmp/d67s774Sws0pEra
   file descriptor
         inode: 295667
         type: socket
         address family: unix
         name @
         peer @

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80603
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-15 17:37:59 +01:00
Alban Crequy
eb4584d5c5 dbus-monitor: do not leak file descriptors from fd-passing
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80603
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-15 17:37:34 +01:00
Ralf Habacker
6864780bd6 Fix installation of empty directories for cmake build system.
The differences has been found out by comparing with the cross compiled
mingw..-dbus packages.

[exclude system bus support bits on Windows -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83583
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-15 13:33:23 +02:00
Simon McVittie
87448fed6f Make various system-bus-related things Unix-only
There is no system bus on Windows, and there won't be until/unless
it can be secure.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83583
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-09-15 13:33:21 +02:00
Simon McVittie
3765075c5f Split _dbus_fd_set_close_on_exec into Unix and Windows versions
On Unix, the thing that can be made close-on-exec is a file descriptor,
which is an int.

On Windows, the thing that can be made close-on-exec is a HANDLE,
which is pointer-sized (but not necessarily a pointer!). In practice,
on Windows we only called _dbus_fd_set_close_on_exec() on socket
pseudo-file-descriptors (SOCKET, which is an unsigned int);
every SOCKET can validly be cast to HANDLE, but not every HANDLE
is a SOCKET.

Before this commit we used an intptr_t as a sort of fake
union { int; HANDLE; }, which just obscures what's going on.

In practice, everything that called _dbus_fd_set_close_on_exec()
is really platform-specific anyway, so let's just have two separate
functions and call this solved.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39610
2014-09-15 13:31:22 +02:00
Simon McVittie
31b3809018 Replace some runtime assertions with compile-time assertions
This requires a little bit of code re-ordering, because
_DBUS_STATIC_ASSERT can appear anywhere that a variable declaration
would be valid, i.e. not after executable code.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83767
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-09-15 12:22:23 +01:00
Simon McVittie
0e3d08d45c Add _DBUS_GNUC_UNUSED, and use it in _DBUS_STATIC_ASSERT
This means we can use _DBUS_STATIC_ASSERT at non-global scope without
tripping -Wunused-local-typedefs.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83767
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-09-15 12:22:09 +01:00
Simon McVittie
79c35a7d5a Merge branch 'dbus-1.8' 2014-09-15 11:51:26 +01:00
Simon McVittie
900011a268 NEWS for 1.8 2014-09-15 11:50:57 +01:00
Simon McVittie
ae50d46ff2 On Linux, call prctl to disable core dumps
Whenever I forget to turn off corekeeper, the regression tests
take ages to record all test-segfault's crashes.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83772
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-09-15 11:50:48 +01:00
Simon McVittie
02731e3718 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
2014-09-12 12:36:20 +01:00
Simon McVittie
467f7a6d42 NEWS for 1.8.x 2014-09-12 12:35:31 +01:00
Umut Tezduyar Lindskog
ae268a2b1a enable build support without systemd compatibility libraries
systemd 209 merged all the libraries to libsystemd. Old
libraries can still be enabled with --enable-compat-libs
switch in systemd but this increases the binary size.

Implement a fallback library check in case compat libraries
dont exist.

[Fixed underquoting; switched priority so we try libsystemd first -smcv]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-12 12:24:18 +01:00
Chengwei Yang
66bac8c3e3 free_pending_restore_data --> free_restore_pending_data
This patch doesn't do any function change, but only the function name,
to align its name with the struct RestorePendingData.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=72254
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-09 14:25:13 +01:00
Ralf Habacker
911d803af1 Port dbus_directory_...() function to use win32 native api instead of opendir()/readdir() and closedir() emulation.
This fixes a license issue introduced by the initial win32 port.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-08 14:38:16 +00:00
Ralf Habacker
89c6173706 Add directory test application 'manual-dir-iter' to cmake and autotools build system.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-08 14:33:37 +00:00
Ralf Habacker
0cde94ecd9 Add dbus string convenience function _dbus_string_init_from_string().
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-08 12:00:42 +00:00
Ralf Habacker
6c8b5ed056 Improve debug message to be able to see empty files.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=57272
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-08 11:58:52 +00:00
Ralf Habacker
4349033667 Merge branch 'dbus-1.8' 2014-09-07 11:37:58 +02:00
Ralf Habacker
575256cd48 Fix windows doc for running tests.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-07 11:36:41 +02:00
Simon McVittie
41676a1a36 NEWS for 1.9 2014-09-05 16:51:02 +01:00
Simon McVittie
496ebc6c5e NEWS for 1.8 2014-09-05 16:48:00 +01:00
Simon McVittie
14fa1a1e75 Merge branch 'dbus-1.8' 2014-09-05 13:41:12 +01:00
Alban Crequy
e2a78c0951 Stats: fix compilation issue
Bug-Gentoo: https://bugs.gentoo.org/show_bug.cgi?id=507232
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=81043
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-09-04 15:42:45 +01:00
Thomas Haller
d8be7e614e doc/dbus-tutorial: fix tutorial to reference the proper GType for 'ay'
DBUS_TYPE_G_BYTE_ARRAY does not exist. It should be DBUS_TYPE_G_UCHAR_ARRAY

Signed-off-by: Thomas Haller <thaller@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80795
2014-09-04 15:38:56 +01:00
Ralf Habacker
d8394d75d1 Win32 cmake msvc16 64 bit native and mingw32/64 4.8.3 cross compile fix.
This patch fixes a "missing include directory" compile error on test-print build target.

Bug: http://lists.freedesktop.org/archives/dbus/2014-August/016260.html
Reviewed-by: rony@wu.ac.at
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-08-08 19:03:05 +02:00
Simon McVittie
a05ef3b129 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2014-07-02 18:33:51 +01:00
Simon McVittie
8f31484171 start 1.8.7 2014-07-02 18:24:44 +01:00
Simon McVittie
194f6f7589 Prepare 1.8.6 in advance 2014-06-30 14:18:03 +01:00
Alban Crequy
9ca90648fc Handle ETOOMANYREFS when sending recursive fds (SCM_RIGHTS)
Since Linux commit 25888e (from 2.6.37-rc4, Nov 2010), sendmsg() on Unix
sockets returns -1 errno=ETOOMANYREFS ("Too many references: cannot splice")
when the passfd mechanism (SCM_RIGHTS) is "abusively" used recursively by
applications. A malicious client could use this to force a victim system
service to be disconnected from the system bus; the victim would likely
respond by exiting. This is a denial of service (fd.o #80163,
CVE-2014-3532).

This patch silently drops the D-Bus message on ETOOMANYREFS and does not close
the connection.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80163
Reviewed-by: Thiago Macieira <thiago@kde.org>
[altered commit message to explain DoS significance -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-30 14:09:21 +01:00
Simon McVittie
07f4c12efe If loader contains two messages with fds, don't corrupt the second
There were two bugs here: we would previously overwrite the unused
fds with the already-used fds instead of the other way round, and
we would copy n bytes where we should have copied n ints.

Additionally, sending crafted messages in a chosen sequence to a victim
system service could cause an invalid file descriptor to be present
when dbus-daemon tries to forward one of those crafted messages to the
victim, causing sendmsg() to fail with EBADF, which resulted in
disconnecting the victim service, which would likely respond to that
by exiting. This is a denial of service (fd.o #80469, CVE-2014-3533).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=79694
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=80469
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-06-30 14:04:32 +01:00
Simon McVittie
93d98e4480 NEWS 2014-06-11 11:56:51 +01:00
Patrick Welche
5d91f615d1 bus_set_watched_dirs: portability patch for systems which lack O_CLOEXEC
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77032
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-11 11:56:25 +01:00
Simon McVittie
d002a430cc Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2014-06-11 11:46:27 +01:00
Simon McVittie
8ab5793b17 NEWS 2014-06-11 11:45:42 +01:00
Simon McVittie
019d192143 NEWS 2014-06-11 11:45:28 +01:00
Patrick Welche
f75e5bdccd configure.ac: backtrace() may be in libexecinfo
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69702
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-11 11:39:48 +01:00
Роман Донченко
5c7ea35c3d dbus-launch: kill bus if we can't attach to a session when requested
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74698
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-11 11:38:24 +01:00
Jaap Boender
be241064f8 Don't call poll(2) with timeout < -1
On Linux, poll accepts any negative value as infinity.
On at least FreeBSD and NetBSD, only -1 is acceptable.

[adjusted whitespace for correct coding style -smcv]
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78480
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-11 11:15:24 +01:00
Lukasz Skalski
980ef1d534 .gitignore: ignore incoming-limit.conf file
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78977
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-06-11 11:14:05 +01:00
Simon McVittie
3488de849d reset version 2014-06-10 18:43:40 +01:00
Simon McVittie
a261ec6695 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2014-06-10 18:36:00 +01:00
Simon McVittie
c3650785fe Prepare embargoed security release 2014-06-05 14:54:36 +01:00
Alban Crequy
24c590703c CVE-2014-3477: deliver activation errors correctly, fixing Denial of Service
How it should work:

When a D-Bus message activates a service, LSMs (SELinux or AppArmor) check
whether the message can be delivered after the service has been activated. The
service is considered activated when its well-known name is requested with
org.freedesktop.DBus.RequestName. When the message delivery is denied, the
service stays activated but should not receive the activating message (the
message which triggered the activation). dbus-daemon is supposed to drop the
activating message and reply to the sender with a D-Bus error message.

However, it does not work as expected:

1. The error message is delivered to the service instead of being delivered to
   the sender. As an example, the error message could be something like:

     An SELinux policy prevents this sender from sending this
     message to this recipient, [...] member="MaliciousMethod"

   If the sender and the service are malicious confederates and agree on a
   protocol to insert information in the member name, the sender can leak
   information to the service, even though the LSM attempted to block the
   communication between the sender and the service.

2. The error message is delivered as a reply to the RequestName call from
   service. It means the activated service will believe it cannot request the
   name and might exit. The sender could activate the service frequently and
   systemd will give up activating it. Thus the denial of service.

The following changes fix the bug:
- bus_activation_send_pending_auto_activation_messages() only returns an error
  in case of OOM. The prototype is changed to return TRUE, or FALSE on OOM
  (and its only caller sets the OOM error).
- When a client is not allowed to talk to the service, a D-Bus error message
  is pre-allocated to be delivered to the client as part of the transaction.
  The error is not propagated to the caller so RequestName will not fail
  (except on OOM).

[fixed a misleading comment -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=78979
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2014-06-05 14:36:17 +01:00
Simon McVittie
6e21873d63 Merge branch 'dbus-1.8'
Conflicts:
	NEWS
	configure.ac
2014-04-30 21:05:46 +01:00
Simon McVittie
416898324d development version 2014-04-30 20:58:39 +01:00
Simon McVittie
789800af43 1.8.2 2014-04-30 20:14:51 +01:00
Руслан Ижбулатов
28812c885f Handle 0x0d0a EOLs in spawn_dbus_daemon()
On W32 dbus daemon will print output in text mode, with 0x0d0a EOLs instead
of just 0x0a. Be able to handle that.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=75863
Reviewed-by: Simon McVittie
2014-04-30 19:42:22 +01:00
Simon McVittie
c02ac70566 NEWS 2014-04-30 19:21:47 +01:00