summaryrefslogtreecommitdiff
path: root/cmake
AgeCommit message (Collapse)AuthorFilesLines
2015-01-05Windows cmake cross compile fixRalf Habacker1-1/+1
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-05Fix of 'dbus-daemon can only handle 64 simultaneous connections on Windows'.Ralf Habacker1-0/+4
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71297 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-09-15config: change DEFAULT_MESSAGE_UNIX_FDS to 16Simon McVittie2-6/+0
This addresses CVE-2014-3636. Based on a patch by Alban Crequy. Now that it's the same on all platforms, there's little point in it being set by configure/cmake. This change fixes two distinct denials of service: fd.o#82820, part A ------------------ Before this patch, the system bus had the following default configuration: - max_connections_per_user: 256 - DBUS_DEFAULT_MESSAGE_UNIX_FDS: usually 1024 (or 256 on QNX, see fd.o#61176) as defined by configure.ac - max_incoming_unix_fds: DBUS_DEFAULT_MESSAGE_UNIX_FDS*4 = usually 4096 - max_outgoing_unix_fds: DBUS_DEFAULT_MESSAGE_UNIX_FDS*4 = usually 4096 - max_message_unix_fds: DBUS_DEFAULT_MESSAGE_UNIX_FDS = usually 1024 This means that a single user could create 256 connections and transmit 256*4096 = 1048576 file descriptors. The file descriptors stay attached to the dbus-daemon process while they are in the message loader, in the outgoing queue or waiting to be dispatched before D-Bus activation. dbus-daemon is usually limited to 65536 file descriptors (ulimit -n). If the limit is reached and dbus-daemon needs to receive a message with a file descriptor attached, this is signalled by recvfrom with the flag MSG_CTRUNC. Dbus-daemon cannot recover from that error because the kernel does not have any API to retrieve a file descriptor which has been discarded with MSG_CTRUNC. Therefore, it closes the connection of the sender. This is not necessarily the connection which generated the most file descriptors so it can lead to denial-of-service attacks. In order to prevent DoS issues, this patch reduces DEFAULT_MESSAGE_UNIX_FDS to 16: max_connections_per_user * max_incoming_unix_fds = 256 * 64 = 16384 This is less than the usual "ulimit -n" (65536) with a good margin to accomodate the other sources of file descriptors (stdin/stdout/stderr, listening sockets, message loader, etc.). Distributors on non-Linux may need to configure a smaller limit in system.conf, if their limit on the number of fds is smaller than Linux's. fd.o#82820, part B ------------------ On Linux, it's not possible to send more than 253 fds in a single sendmsg() call: sendmsg() would return -EINVAL. #define SCM_MAX_FD 253 SCM_MAX_FD changed value during Linux history: - it used to be (OPEN_MAX-1) - commit c09edd6eb (Jul 2007) changed it to 255 - commit bba14de98 (Nov 2010) changed it to 253 Libdbus always sends all of a message's fds, and the beginning of the message itself, in a single sendmsg() call. Combining these two, a malicious sender could split a message across two or more sendmsg() calls to construct a composite message with 254 or more fds. When dbus-daemon attempted to relay that message to its recipient in a single sendmsg() call, it would receive EINVAL, interpret that as a fatal socket error and disconnect the recipient, resulting in denial of service. This is fixed by keeping max_message_unix_fds <= SCM_MAX_FD. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82820 Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2014-01-27Fix of 'dbus-daemon can only handle 64 simultaneous connections on Windows'.Cristian Onet2-0/+6
[Slightly modified by -rh] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71297 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-21Give cmake users some hints/requirements when cross compiling for Windows on ↵Ralf Habacker2-0/+31
Linux. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17Let cmake 'make check' run test applications as test group.Ralf Habacker1-11/+1
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17Rename bus-test-launch-helper to test-bus-launch_helper to match common test ↵Ralf Habacker1-2/+2
application naming scheme. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17Rename bus-test to test-bus to match common test application naming scheme.Ralf Habacker1-2/+2
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17Rename spawn-test to test-spawn to match common test application naming scheme.Ralf Habacker1-2/+2
[Same change as for shell-test in the previous commit. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17Rename shell-test to test-shell to match common test application naming scheme.Ralf Habacker1-3/+3
[Add its source file to SOURCES: this test was previously relying on the Automake feature that the default value of foo_bar_SOURCES is foo-bar.c. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17Rename dbus-test to test-dbus to match common test application naming scheme.Ralf Habacker1-2/+2
[reverted the dbus-specification part -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=73495 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-17CMake warning--.Ralf Habacker1-1/+1
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10tests: don't block and wait for a debugger on abortSimon McVittie1-1/+0
In general, I think developers running the tests would expect them to terminate rather than hanging. Developers who want to debug such an abort by attaching a debugger to a live process can still set DBUS_BLOCK_ON_ABORT in the environment. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-01-10Use macros for test and helper executable targets on cmake build system.Ralf Habacker5-101/+61
The new macros add_test_executables and add helper_executables provides a platform independent way for specifing dbus test and service applications. On native Windows and Linux/UNIX systems the test applications are directly runable. When cross compiling for Windows on Linux test applications could be executed on the Linux host system with the help of wine and activated binfmt_misc support for wine. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10Add 'check' cmake target to keep in sync with autotools.Ralf Habacker1-0/+14
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10Create session.conf and system.conf for test/data/valid-config-files from ↵Ralf Habacker1-2/+5
*.in files on cmake. We need to patch the listen address. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10Define TEST_BUS_LAUNCH_BINARY for cmake to keep in sync with autotools.Ralf Habacker3-4/+2
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10Use cmake build in executable suffix.Ralf Habacker1-3/+2
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-08Remove obsolete cmake project tags in sub directories; we only have one project.Ralf Habacker4-7/+0
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68506 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-07Add glib support to cmake buildsystem.Ralf Habacker6-42/+186
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68506 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-11-27cmake: fix code styleChengwei Yang1-3/+3
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66453 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-10-08Unify the way to find dbus-daemon test binaryChengwei Yang1-3/+0
There are two ways to find the dbus-daemon for testing. The first one is defined as string at compile stage and the second one is export it from test environment. The first way has limitation that after defined, it's static string, so it's impossible to run installable check. So let's unify to the second way. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37849 [added missing "}" -smcv] Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-09-16Remove support for platforms with no 64-bit integer typeSimon McVittie1-4/+2
This has been a soft requirement since 1.5.0; anyone on such platforms would have had to configure --without-64-bit, provoking a warning that instructed them to report a D-Bus bug with details of their platform. Nobody has done so, so if anyone still lacks a 64-bit integer type, they're on their own. (Also, I tried the build with --without-64-bit and it's full of fatal compiler warnings, so it's not clear that we're actually losing anything by removing this "feature".) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65429 Reviewed-by: Chengwei Yang <chengwei.yang@intel.com>
2013-09-16dbus-sysdeps-win: don't include wspiapi.hSimon McVittie2-4/+0
This block provoked a warning on mingw-w64 because we were redefining _inline. According to Ralf's research, it was introduced in 452ff68a: Windows 2000 doesn't have getaddrinfo and related functions in ws2tcpip.h, but does have a shim implementation in wspiapi.h. At the time of 452ff68a, mingw32 didn't have wspiapi.h, so it's unclear why there was a __GNUC__ code path here. The "#define _inline" on that code path looks likely to be some sort of workaround for a faulty version of wspiapi.h? Current mingw-w64 does have wspiapi.h, so we enter the __GNUC__ code path and get the redefinition. dbus no longer supports Windows 2000, so we no longer need wspiapi.h at all, and can rely on XP or later. (Ralf's policy is to only support versions of Windows that are still supported by Microsoft, and Windows 2000 reached the end of its life-cycle in 2010.) Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852 Reviewed-by: Ralf Habacker
2013-09-03Tests: allow dbus-glib to be replaced with use of libdbus-internalSimon McVittie2-2/+4
We only use dbus-glib for its main loop; within dbus, DBusLoop is available as an alternative, although it isn't thread-safe and isn't public API. For tests that otherwise only use libdbus public API, it's desirable to be able to avoid DBusLoop, so we can run them against an installed libdbus as an integration test. However, if we don't have dbus-glib, we're going to have to use an in-tree main loop, which might as well be DBusLoop. The major disadvantage of using dbus-glib is that it isn't safe to link both dbus-1 and dbus-internal at the same time. This is awkward for a future test case that wants to use _dbus_getsid() in dbus-daemon.c, but only on Windows (fd.o #54445). If we use the same API wrapper around both dbus-glib and DBusLoop, we can compile that test against dbus-glib or against DBusLoop, depending on the platform. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-09-03Define DBUS_COMPILATION externally for all tests that use internal stuffSimon McVittie1-1/+1
It might as well go in the AM_CPPFLAGS rather than in the source code. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68852 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-08-28Generate autotools provided PACKAGE_.. and VERSION defines by a cmake macro.Ralf Habacker3-1/+74
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=67072 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-28Fixed mingw gcc 4.8.1 complains about double defined macros.Ralf Habacker1-8/+1
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=67072 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23Revert "Factor out DBusAuthorization from DBusTransport"Simon McVittie1-2/+0
This reverts commit 600621dbc8073527a958091316eddfbb490c1032.
2013-08-23Factor out DBusAuthorization from DBusTransportCosimo Alfarano1-0/+2
In order to authorize/reject a connection in a polite way, instead of cutting it off after authentication succeed and Hello() is sent, because authorization failed, we need to factor out some authorization bits from DBusTransport and pass them to DBusAuth. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39720 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-07-01cmake: do not bind to any particular POSIX C standardChengwei Yang1-1/+1
This caused build failures on FreeBSD. Defining _POSIX_C_SOURCE to a particular version will disable common non-POSIX extensions like PF_UNIX, and on some systems will also disable features of later POSIX versions, like IPv6. If we don't ask for a specific version, we'll get some sort of sensible default. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66257 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> [made the commit message more concise -smcv] Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-28tests to embedded tests: replaced in cmake filesChengwei Yang5-10/+11
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66291
2013-06-28cmake: align dir watch backend detection with autotoolsChengwei Yang2-7/+33
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66257
2013-06-28cmake: terminate to generate makefiles due to fatal errorChengwei Yang1-2/+2
FATAL isn't a valid key for message according to cmake document here. http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command%3amessage Due to the real fatal error, FATAL_ERROR should be used to terminate cmake from continue generating makefiles. Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66257
2013-06-28cmake: get rid of useless commented out codeChengwei Yang1-48/+0
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66257
2013-06-28dir-watch: remove dnotify backendChengwei Yang2-7/+0
dnotify as a dir watch backend is broken since Jan 2010 (almost 3.5 years). According to fd.o: #33001, it's no harm to remove dnotify from this project. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33001 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-28cmake: clean up libxml2 glueChengwei Yang1-5/+3
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66257
2013-06-25Explicitly define macros to get less confusing conditionsChengwei Yang1-0/+6
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65990 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-25Convert a{sv} helpers from Stats into generic utility codeSimon McVittie1-0/+2
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-06-25cmake: remove a duplicate line and fix coding styleChengwei Yang1-3/+1
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66142 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-25cmake: fix a typo DBUS_DISABLE_ASSERTS should be DBUS_DISABLE_ASSERTChengwei Yang2-9/+9
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66142 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-24Use Doxyfile.in for cmake build system too.Ralf Habacker2-182/+2
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64875 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-18Fix of cmake xmldoc dependencies chain.Ralf Habacker1-7/+12
This patch fixes an issues that xml documentation is generated on all builds regardless if related files has been changed or not. The patch adds a global xmldoc make target to which all generated html or man files are added as build dependency. Each dependency itself depends on related CMakeLists.txt and the xml file generated from the related xml.in file. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64058 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-18Fixed wrong path for generated xml files when creating man pages with cmake.Ralf Habacker1-5/+5
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64058 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-06-17Replace individual global-lock variables with an array of DBusRMutex *Simon McVittie1-1/+0
This means we can use a much simpler code structure in data-slot allocators: instead of giving them a DBusRMutex ** at first-allocation, we can just give them an index into the array, which can be done statically. It doesn't make us any more thread-safe-by-default - the mutexes will only actually be used if threads were already initialized - but it's substantially better than nothing. These locks really do have to be recursive: for instance, internal_bus_get() calls dbus_bus_register() under the bus lock, and dbus_bus_register() can call _dbus_connection_close_possibly_shared(), which takes the bus lock. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> Reviewed-by: Anas Nashif <anas.nashif@intel.com>
2013-06-06XML: hard depends on expat and delete libxmlChengwei Yang3-30/+6
[The libxml code path has been broken for at least 2.5 years, and Expat is tiny, so there seems no point in supporting both. -smcv] Bug: https://bugs.freedesktop.org/show_bug.cgi?id=20253 Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-05-10dbus_threads_init_default, dbus_threads_init: be safe to call at any timeSimon McVittie1-0/+1
On Unix, we use a pthreads mutex, which can be allocated and initialized in global memory. On Windows, we use a CRITICAL_SECTION, together with a call to InitializeCriticalSection() from the constructor of a global static C++ object (thanks to Ralf Habacker for suggesting this approach). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-04-29Fixed cmake windows build system bug not installing runtime part of shared ↵Ralf Habacker2-1/+7
libraries into bin dir. This patch also take care of different install directories on unix like os. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-18Rename default_message_unix_fds to DEFAULT_MESSAGE_UNIX_FDSSimon McVittie2-2/+2
As Ralf pointed out, we usually use upper-case when substituting variables (apart from "somethingdir", which Autoconf conventionally makes lower-case for some reason). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63682 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2013-04-18cmake: define default_message_unix_fds so it can be substituted in session.confSimon McVittie2-1/+5
This fixes a regression since 1.7.0: session.conf would be invalid when generated by cmake. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63682 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>