Commit graph

3511 commits

Author SHA1 Message Date
Simon McVittie
24a9b93021 Turn a runtime assertion into a compile-time assertion
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-05-10 17:04:31 +01:00
Simon McVittie
e8136f0d30 NEWS for part 1 of fd.o#54972 2013-05-10 12:59:35 +01:00
Simon McVittie
17a23d08b5 dbus_threads_init_default, dbus_threads_init: be safe to call at any time
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-05-10 11:35:08 +01:00
Simon McVittie
863c989bb6 Fix compiler warnings when X11 autolaunch and launchd are both disabled
From the department of "if it isn't tested, it doesn't work". I tried
compiling dbus without an assortment of optional features:

    in_builddir ~/build/dbus/legacy ${MR_REPO}/configure \
        --enable-developer --enable-maintainer-mode --enable-tests \
        dbus_cv_sync_sub_and_fetch=no \
        --disable-selinux \
        --disable-inotify \
        --disable-dnotify \
        --disable-epoll \
        --disable-kqueue \
        --disable-launchd \
        --disable-systemd \
        --disable-libaudit \
        --without-valgrind \
        --disable-x11-autolaunch \
        && ...

and it resulted in -Wunused warnings.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=64362
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
2013-05-10 11:34:42 +01:00
Simon McVittie
eabf6c42a1 dbus_threads_init: call _dbus_threads_init_platform_specific()
This reverses the relationship between these two functions.
Previously, dbus_threads_init() wouldn't allocate dbus_cond_event_tls
on Windows, call check_monotonic_clock on Unix, or call
_dbus_check_setuid on Unix.

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-05-09 10:33:38 +01:00
Simon McVittie
c36f21a2e9 DBusAtomic: on Unix, use pthreads mutexes for fallback
On pthreads platforms, POSIX guarantees that we can "allocate" mutexes
as library-global variables, without involving malloc. This means we
don't need to error-check their allocation - if the dynamic linker
succeeds, then we have enough memory for all our globals - which is an
important step towards being thread-safe by default. In particular,
making atomic operations never rely on DBusMutex means that we are free
to implement parts of DBusMutex in terms of DBusAtomic, if it would help.

We do not currently support any non-Windows platform that does not have
pthreads. This is unlikely to change.

On Windows, we already used real atomic operations; we can just
delete the unused global variable.

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-05-09 10:32:54 +01:00
Simon McVittie
7ac9b68220 Add _DBUS_GNUC_WARN_UNUSED_RESULT, similar to GLib's
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk>
2013-05-08 14:34:16 +01:00
Simon McVittie
bd5cec18cd NEWS 2013-05-08 14:30:46 +01:00
Simon McVittie
82b3d94ab1 start spec 0.22 development 2013-05-02 14:50:34 +01:00
Simon McVittie
657a589a98 start 1.7.4 development 2013-05-02 14:50:34 +01:00
Ralf Habacker
286923789e Fixed cmake windows build system bug not installing runtime part of shared 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-29 20:42:30 +02:00
Simon McVittie
7ff0cd0640 prepare version 1.7.2 and spec 0.21 2013-04-25 13:12:15 +01:00
Simon McVittie
1f3b479a12 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
	configure.ac
2013-04-24 20:31:28 +01:00
Simon McVittie
1d560ff7f9 development version 2013-04-24 20:30:00 +01:00
Simon McVittie
a1883ddcac Prepare release 1.6.10 2013-04-24 12:14:57 +01:00
Simon McVittie
79c150c519 NEWS for 1.7 2013-04-23 19:16:23 +01:00
Simon McVittie
684916fb67 Disable sd-daemon.c's support for POSIX message queues
This fixes build failures with recent glibc while avoiding an
otherwise useless librt dependency.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63166
Reviewed-by: Thiago Macieira <thiago@kde.org>
2013-04-23 17:46:24 +01:00
Simon McVittie
9e04ddba7d NEWS for 1.7 2013-04-22 16:21:02 +01:00
Cristian Rodríguez
235fd739a4 dbus.service.in: Do not order after syslog.target
It is no longer required or recommended in fact it no longer
exists since
http://cgit.freedesktop.org/systemd/systemd/commit/?id=5d4caf565471ff3401bd9b53aa814c8545a18a93

[Clarification: there are two reasons why we do not need that dependency.
First, we do not have DefaultDependencies=no, so we only get run after
sockets.target. Second, syslog.socket doesn't provide /dev/log, which is
part of systemd-journald.socket. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63531
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-22 16:17:48 +01:00
Simon McVittie
0c97243219 Specification: explicitly allow the Unicode noncharacters
This follows Unicode Corrigendum #9.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63072
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-22 16:16:09 +01:00
Simon McVittie
5f12e6e081 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
2013-04-22 16:16:03 +01:00
Simon McVittie
6d7782659a NEWS for 1.6 2013-04-22 16:15:34 +01:00
Simon McVittie
6b2add5e70 Accept non-characters when validating Unicode
Unicode Corrigendum #9 clarifies that the non-characters U+nFFFE
(for n in the range 0 to 0x10), U+nFFFF (for n in the same range),
and U+FDD0..U+FDEF are valid for interchange, and their presence
does not make a string ill-formed.

GLib 2.36 made the corresponding change in its definition of UTF-8
as used by g_utf8_validate() and similar functions.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63072
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-22 15:36:32 +01:00
Ralf Habacker
7467a410ef Unify docbook dtd version to 4.4.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59805
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-19 12:40:01 +01:00
Simon McVittie
c27d913789 NEWS 2013-04-18 19:26:59 +01:00
Simon McVittie
2872422718 Rename default_message_unix_fds to DEFAULT_MESSAGE_UNIX_FDS
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-18 19:21:51 +01:00
Simon McVittie
1502908465 cmake: define default_message_unix_fds so it can be substituted in session.conf
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>
2013-04-18 19:21:18 +01:00
Simon McVittie
68c1a26d1e sd-daemon.c: update from systemd for better portability 2013-04-16 17:40:41 +01:00
Simon McVittie
1aaeb6afd0 NEWS for 1.7 2013-04-11 14:00:15 +01:00
Matt Fischer
977293549d Set default maximum number of Unix fds according to OS
QNX has an arbitrary limit to the number of file descriptors
which may be passed in a message, which is smaller than the
current default.  This patch therefore changes the default from
a hardcoded constant to a macro, which is determined at configure
time by looking at the host operating system.

[This reduces the limit from 4096 (session)/1024 (system) to 128 fds
per message on QNX, and 1024 fds per message on other operating systems.
I think the reduced session bus limit on other OSs is a reasonable change
too, given that the default hard/soft ulimits in Linux are only 4096/1024
fds per process. -smcv]

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61176
Reviewed-by: Simon McVittie <simon.mcvittie.collabora.co.uk>
2013-04-11 13:34:55 +01:00
Simon McVittie
2ab900b678 Do not suppress syslog test's stderr just because init is systemd
This causes the test to fail. The assumption implicitly being made was
"if pid 1 is systemd, then every caller of _dbus_init_system_log() is a
systemd service" which is not valid for the regression test.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63163
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Colin Walters <walters@verbum.org>
2013-04-08 12:17:28 +01:00
Simon McVittie
60511bb995 fix NEWS: a Windows "sid" is a security ID, not a session ID 2013-04-05 17:01:29 +01:00
Simon McVittie
3b1ad7f7c5 Merge branch 'dbus-1.6'
Conflicts:
	NEWS
	configure.ac
2013-04-05 13:00:22 +01:00
Simon McVittie
71fc71fe55 NEWS for 1.7 2013-04-05 12:57:56 +01:00
Simon McVittie
540e5692e0 Allow use of GLib 2.32 functionality, which we do conditionally 2013-04-05 12:54:57 +01:00
Simon McVittie
c052230fff Don't warn for functions deprecated since GLib 2.26
Also warn if we inadvertently use a function introduced since then.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59971
Reviewed-by: Colin Walters <walters@verbum.org>
2013-04-05 12:48:23 +01:00
Simon McVittie
02be6d0553 NEWS for 1.6 2013-04-05 12:47:07 +01:00
Dan Williams
1495c207b4 Don't access random memory if data slot isn't allocated yet
If DBUS_DISABLE_ASSERTS was turned on, and a buggy program called
dbus_connection_get_data() with a slot number less than zero (eg,
before even allocating the data slot), random memory would be
accessed and a random value returned.  Anything less than zero
is not a valid slot number and should be rejected by libdbus.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63127
Signed-off-by: Dan Williams <dcbw@redhat.com>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-05 12:45:18 +01:00
Ralf Habacker
8159956ed4 Add function _dbus_get_peer_pid_from_tcp_handle() which returns pid and sid from tcp connection peer.
This function is called by _dbus_read_credentials_socket() to fetch client credentials.

Because Wine is used to check cross compiled dbus for windows, in calls to GetExtendedTcpTable()
we use table class TCP_TABLE_OWNER_PID_ALL instead of TCP_TABLE_OWNER_PID_CONNECTIONS.
This class is the only one which is available since wine 1.5.3.

https://bugs.freedesktop.org/show_bug.cgi?id=61787
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-05 11:17:26 +02:00
Simon McVittie
89c1ecdd7c Merge branch 'dbus-1.6' 2013-04-03 12:22:24 +01:00
Simon McVittie
aa8dcc13a6 NEWS for 1.6 2013-04-03 12:20:57 +01:00
Dagobert Michelsen
6485fafbca If alloca.h is available it is required (e.g. on Solaris 10)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=63071
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-03 12:17:44 +01:00
Dagobert Michelsen
ee49d0672a HAVE_DECL_LOG_PERROR is 0 when unavailable
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39987
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-04-03 12:10:35 +01:00
Martin Pitt
751f6783c4 Update sd-daemon.[hc] from upstream
This fixes sd_booted() to actually mean "have systemd init", which we need for
_dbus_init_system_log() to decide whether systemd journal is being used.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62585
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-03-25 13:59:17 +00:00
Martin Pitt
e25938d527 Fix test for logind availability
sd_booted() is not an appropriate check for whether we should talk to logind,
test for /run/systemd/seats/ instead.

For details, see:
<https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00092.html>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62585
[trivial whitespace fix -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-03-25 13:57:57 +00:00
Ralf Habacker
15b2d2bb25 Rename the term 'unix_pid' to 'pid' in variables and functions.
Windows also has numeric process IDs that fit in an unsigned long, so
there's no reason this has to be Unix-specific.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61787
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-03-08 23:29:22 +01:00
Ralf Habacker
73df9770b3 Do not retrieve credential information from the wrong side of the connection.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61787
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-03-08 18:05:20 +01:00
Ralf Habacker
e53229e42c Debug message eol fix. 2013-03-08 08:34:03 +01:00
Ralf Habacker
57c35091a1 CMake linux fixes when using meinproc4 doc generator.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61637
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-03-04 18:27:08 +01:00
Ralf Habacker
76503373e6 Fix cmake linux build: dbus-1 and dbus-internal require to link to rt library
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61637
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-03-04 18:26:06 +01:00